One call to get stats
This commit is contained in:
@@ -10,9 +10,9 @@ const getSlug = text => {
|
|||||||
|
|
||||||
module.exports = createCoreController('api::artiste.artiste', ({strapi}) => ({
|
module.exports = createCoreController('api::artiste.artiste', ({strapi}) => ({
|
||||||
async count(ctx) {
|
async count(ctx) {
|
||||||
const {query} = ctx.request
|
const countArtiste = await strapi.entityService.count('api::artiste.artiste')
|
||||||
const result = await strapi.entityService.count('api::artiste.artiste', query)
|
const countParole = await strapi.entityService.count('api::parole.parole')
|
||||||
return result
|
return {countArtiste, countParole}
|
||||||
},
|
},
|
||||||
async create(ctx) {
|
async create(ctx) {
|
||||||
const {body} = ctx.request
|
const {body} = ctx.request
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ module.exports = {
|
|||||||
routes: [
|
routes: [
|
||||||
{
|
{
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
path: '/artiste/count',
|
path: '/stats',
|
||||||
handler: 'artiste.count',
|
handler: 'artiste.count',
|
||||||
config: {
|
config: {
|
||||||
auth: false,
|
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