One call to get stats
This commit is contained in:
@@ -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,
|
||||
@@ -1,12 +0,0 @@
|
||||
module.exports = {
|
||||
routes: [
|
||||
{
|
||||
method: 'GET',
|
||||
path: '/parole/count',
|
||||
handler: 'parole.count',
|
||||
config: {
|
||||
auth: false,
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user