One call to get stats

This commit is contained in:
Cédric FAMIBELLE-PRONZOLA
2022-05-23 00:11:51 +04:00
parent 3d3bda6656
commit 2c9f3f2891
3 changed files with 4 additions and 16 deletions
+3 -3
View File
@@ -10,9 +10,9 @@ const getSlug = text => {
module.exports = createCoreController('api::artiste.artiste', ({strapi}) => ({
async count(ctx) {
const {query} = ctx.request
const result = await strapi.entityService.count('api::artiste.artiste', query)
return result
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
@@ -2,7 +2,7 @@ module.exports = {
routes: [
{
method: 'GET',
path: '/artiste/count',
path: '/stats',
handler: 'artiste.count',
config: {
auth: false,
-12
View File
@@ -1,12 +0,0 @@
module.exports = {
routes: [
{
method: 'GET',
path: '/parole/count',
handler: 'parole.count',
config: {
auth: false,
}
}
]
}