Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const sanitizeUser = user =>
sanitizeEntity(user, {
model: strapi.query('user', 'users-permissions').model,
});
async findOne(ctx) {
const entity = await service.findOne(ctx.params);
return sanitizeEntity(entity, { model });
},
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 });
},