Add count method to artiste & parole
This commit is contained in:
@@ -9,6 +9,11 @@ const getSlug = text => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = createCoreController('api::artiste.artiste', ({strapi}) => ({
|
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) {
|
async create(ctx) {
|
||||||
const {body} = ctx.request
|
const {body} = ctx.request
|
||||||
let {data} = body
|
let {data} = body
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
module.exports = {
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
method: 'GET',
|
||||||
|
path: '/artiste/count',
|
||||||
|
handler: 'artiste.count',
|
||||||
|
config: {
|
||||||
|
auth: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -3,6 +3,11 @@
|
|||||||
const { createCoreController } = require('@strapi/strapi').factories;
|
const { createCoreController } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
module.exports = createCoreController('api::parole.parole', ({strapi}) => ({
|
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) {
|
async findOne(ctx) {
|
||||||
const {id} = ctx.params
|
const {id} = ctx.params
|
||||||
const parole = await strapi.entityService.findOne('api::parole.parole', id, {
|
const parole = await strapi.entityService.findOne('api::parole.parole', id, {
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
module.exports = {
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
method: 'GET',
|
||||||
|
path: '/parole/count',
|
||||||
|
handler: 'parole.count',
|
||||||
|
config: {
|
||||||
|
auth: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user