Strapi V3 core controller extend

System Information
  • Strapi Version: 3.6.11
  • Operating System: Win 11
  • Database: sqlPostgress
  • Node Version: v19.2.0
  • NPM Version: 8.19.3
  • Yarn Version: N/A

I am trying to override a single value controller, I want to call an API after updating the value and notify the user about the API call response,

The issue is that, Strapi does not call the extended update method, instead it always call the default one, I have the Internationalization plugin installed, So I should consider localization.

There is my code

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

/**
 * Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#core-controllers)
 * to customize this controller
 */

module.exports = {
  /**
   * Update terms and conditions
   * @return {Object}
   */
  async update(ctx) {
    ctx.log.info("Updating terms and conditions"); // ctx.log.info(folders);
    let entity;
    if (ctx.is('multipart')) {
      const { data, files } = parseMultipartData(ctx);
      entity = await strapi.services.terms_and_conditions.createOrUpdate(data, {
        files,
      });
    } else {
      entity = await strapi.services.terms_and_conditions.createOrUpdate(ctx.request.body);
    }

    ctx.log.debug("Calling email API"); // ctx.log.info(folders);

    try {
      const api = strapi.config.get("server.api.common", "");
      const response = await fetch(`${api}terms-changed-email`, {
        method: 'POST',
        headers: {
          'content-type': 'application/json',
        },
        body: {
          termsLink: strapi.config.get("server.data.termsLink", "")
        }
      });

      const jsonResponse = await response.json();
      const { code, success } = jsonResponse;

      if (!success) {
        ctx.log.debug(jsonResponse);
        return ctx.badRequest(null, `Can not send update emails error code ${code}`);
      } else {
        ctx.log.debug(`Email sent with response`, jsonResponse);
      }
    } catch (e) {
      strapi.log.debug(e);
      return ctx.badRequest(null, `Can not send update emails error code ${e.message}`);
    }

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

Thank you all in advance