Pierre Noël 407949a70a use findAll instead of find
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 10:50:51 +02:00

23 lines
407 B
JavaScript

'use strict';
module.exports = {
async findOne(ctx) {
const { id } = ctx.params;
const role = await strapi.admin.services.role.findOne({ id });
if (!role) {
return ctx.notFound('role.notFound');
}
ctx.body = {
data: role,
};
},
async findAll(ctx) {
const roles = await strapi.admin.services.role.findAll();
ctx.body = {
data: roles,
};
},
};