Replace 'stats' from artiste to new controller 'stats'

This commit is contained in:
Cédric FAMIBELLE-PRONZOLA
2022-05-23 00:51:59 +04:00
parent 2c9f3f2891
commit 894c56014f
3 changed files with 11 additions and 7 deletions
-5
View File
@@ -9,11 +9,6 @@ const getSlug = text => {
} }
module.exports = createCoreController('api::artiste.artiste', ({strapi}) => ({ 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) { async create(ctx) {
const {body} = ctx.request const {body} = ctx.request
let {data} = body let {data} = body
+9
View File
@@ -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}
}
}
@@ -3,10 +3,10 @@ module.exports = {
{ {
method: 'GET', method: 'GET',
path: '/stats', path: '/stats',
handler: 'artiste.count', handler: 'stats.count',
config: { config: {
auth: false, auth: false,
} }
} }
] ]
} }