diff --git a/src/api/artiste/controllers/artiste.js b/src/api/artiste/controllers/artiste.js index 72b5f55..0afa557 100644 --- a/src/api/artiste/controllers/artiste.js +++ b/src/api/artiste/controllers/artiste.js @@ -9,11 +9,6 @@ const getSlug = text => { } module.exports = createCoreController('api::artiste.artiste', ({strapi}) => ({ - async count(ctx) { - const countArtiste = await strapi.entityService.count('api::artiste.artiste') - const countParole = await strapi.entityService.count('api::parole.parole') - return {countArtiste, countParole} - }, async create(ctx) { const {body} = ctx.request let {data} = body diff --git a/src/api/stats/controllers/stats.js b/src/api/stats/controllers/stats.js new file mode 100644 index 0000000..49fc8f1 --- /dev/null +++ b/src/api/stats/controllers/stats.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = { + async count(ctx, next) { + const countArtiste = await strapi.entityService.count('api::artiste.artiste') + const countParole = await strapi.entityService.count('api::parole.parole') + return {countArtiste, countParole} + } +} diff --git a/src/api/artiste/routes/stats.js b/src/api/stats/routes/stats.js similarity index 79% rename from src/api/artiste/routes/stats.js rename to src/api/stats/routes/stats.js index 5b4c777..61cfa56 100644 --- a/src/api/artiste/routes/stats.js +++ b/src/api/stats/routes/stats.js @@ -3,10 +3,10 @@ module.exports = { { method: 'GET', path: '/stats', - handler: 'artiste.count', + handler: 'stats.count', config: { auth: false, } } ] -} +} \ No newline at end of file