Add count method to artiste & parole

This commit is contained in:
Cédric FAMIBELLE-PRONZOLA
2022-05-22 23:09:19 +04:00
parent ac45f2f5e2
commit 3d3bda6656
4 changed files with 34 additions and 0 deletions
+5
View File
@@ -9,6 +9,11 @@ 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
},
async create(ctx) {
const {body} = ctx.request
let {data} = body
+12
View File
@@ -0,0 +1,12 @@
module.exports = {
routes: [
{
method: 'GET',
path: '/artiste/count',
handler: 'artiste.count',
config: {
auth: false,
}
}
]
}
+5
View File
@@ -3,6 +3,11 @@
const { createCoreController } = require('@strapi/strapi').factories;
module.exports = createCoreController('api::parole.parole', ({strapi}) => ({
async count(ctx) {
const {query} = ctx.request
const result = await strapi.entityService.count('api::parole.parole', query)
return result
},
async findOne(ctx) {
const {id} = ctx.params
const parole = await strapi.entityService.findOne('api::parole.parole', id, {
+12
View File
@@ -0,0 +1,12 @@
module.exports = {
routes: [
{
method: 'GET',
path: '/parole/count',
handler: 'parole.count',
config: {
auth: false,
}
}
]
}