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

Hi @MattieBelt and thanks for the quick answer!

I try to explain better. What I’m trying to achieve is to check if a user leave a relation field blank in the backend editing a content type item and, if the relation field is blank, throw a validation error and to stop the saving process.

So, I now that this process is manages, in Strapi, by (in Strapi/lib/services/entity-service.js):

async update({ params, data, files }, { model }) {
const modelDef = db.getModel(model);
const existingEntry = await db.query(model).findOne(params);

const isDraft = contentTypesUtils.isDraft(existingEntry, modelDef);

const validData = await entityValidator.validateEntityUpdate(modelDef, data, {
  isDraft,
});

How can I “hook” this async update method?

Thanks!

1 Like