How to customize Strapi backend (content-manager) controllers, services and validation?

For the default controllers and services, you do what is an overwrite method. Using the examples provided in:

In your case, you are looking at a service, depending on what you are intending to do (such as returning an error to the user) I would usually suggest modifying the controller for validation related stuff.

So for your model you will find an “empty” file at ./api/yourModel/controllers/yourModel.js where you would put something like:

const { parseMultipartData, sanitizeEntity } = require('strapi-utils');

module.exports = {
  /**
   * Update a record.
   *
   * @return {Object}
   */

  async update(ctx) {
    const { id } = ctx.params;

    if (!missing something) {
      return ctx.badRequest('Some error message')
    }

    let entity;
    if (ctx.is('multipart')) {
      const { data, files } = parseMultipartData(ctx);
      entity = await strapi.services.restaurant.update({ id }, data, {
        files,
      });
    } else {
      entity = await strapi.services.restaurant.update({ id }, ctx.request.body);
    }

    return sanitizeEntity(entity, { model: strapi.models.restaurant });
  },
};