Filter stats, exclude draft

This commit is contained in:
Cédric FAMIBELLE-PRONZOLA
2022-05-26 03:04:33 +04:00
parent 924869995e
commit 4f5aab0ace
+22 -2
View File
@@ -3,13 +3,22 @@
module.exports = { module.exports = {
async count(ctx, next) { async count(ctx, next) {
const countArtiste = await strapi.entityService.count('api::artiste.artiste') const countArtiste = await strapi.entityService.count('api::artiste.artiste')
const countParole = await strapi.entityService.count('api::parole.parole') const countParole = await strapi.entityService.count('api::parole.parole', {
filters: {
publishedAt: {
$notNull: true,
}
}
})
const countParoleWithoutFrancais = await strapi.entityService.count('api::parole.parole', { const countParoleWithoutFrancais = await strapi.entityService.count('api::parole.parole', {
filters: { filters: {
traductions: { traductions: {
francais: { francais: {
$null: true $null: true
} }
},
publishedAt: {
$notNull: true,
} }
} }
}) })
@@ -20,6 +29,9 @@ module.exports = {
anglais: { anglais: {
$null: true $null: true
} }
},
publishedAt: {
$notNull: true,
} }
} }
}) })
@@ -30,6 +42,9 @@ module.exports = {
espagnol: { espagnol: {
$null: true $null: true
} }
},
publishedAt: {
$notNull: true,
} }
} }
}) })
@@ -40,6 +55,9 @@ module.exports = {
allemand: { allemand: {
$null: true $null: true
} }
},
publishedAt: {
$notNull: true,
} }
} }
}) })
@@ -50,6 +68,9 @@ module.exports = {
italien: { italien: {
$null: true $null: true
} }
},
publishedAt: {
$notNull: true,
} }
} }
}) })
@@ -70,7 +91,6 @@ module.exports = {
italien: countParoleWithoutItalien, italien: countParoleWithoutItalien,
} }
console.log('artisteWithoutBio', artistesWithoutBio)
return {countArtiste, countParole, artistesWithoutBio, parolesWithoutTranslation} return {countArtiste, countParole, artistesWithoutBio, parolesWithoutTranslation}
} }
} }