How to use the strapi-utils.sanitizeEntity function in strapi-utils

To help you get started, we’ve selected a few strapi-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strapi / strapi / packages / strapi-plugin-users-permissions / controllers / User.js View on Github external
const sanitizeUser = user =>
  sanitizeEntity(user, {
    model: strapi.query('user', 'users-permissions').model,
  });
github strapi / strapi / packages / strapi / lib / core-api / controller.js View on Github external
async findOne(ctx) {
      const entity = await service.findOne(ctx.params);
      return sanitizeEntity(entity, { model });
    },
github strapi / strapi / packages / strapi / lib / core-api / controller.js View on Github external
async update(ctx) {
      let entity;
      if (ctx.is('multipart')) {
        const { data, files } = parseMultipartData(ctx);
        entity = await service.update(ctx.params, data, { files });
      } else {
        entity = await service.update(ctx.params, ctx.request.body);
      }

      return sanitizeEntity(entity, { model });
    },