Files
api.pawol.nu/src/api/stats/controllers/stats.js
T

97 lines
2.3 KiB
JavaScript
Raw Normal View History

'use strict';
module.exports = {
async count(ctx, next) {
const countArtiste = await strapi.entityService.count('api::artiste.artiste')
2022-05-26 03:04:33 +04:00
const countParole = await strapi.entityService.count('api::parole.parole', {
filters: {
publishedAt: {
$notNull: true,
}
}
})
2022-05-25 06:40:50 +04:00
const countParoleWithoutFrancais = await strapi.entityService.count('api::parole.parole', {
filters: {
traductions: {
francais: {
$null: true
}
2022-05-26 03:04:33 +04:00
},
publishedAt: {
$notNull: true,
2022-05-25 06:40:50 +04:00
}
}
})
const countParoleWithoutAnglais = await strapi.entityService.count('api::parole.parole', {
filters: {
traductions: {
anglais: {
$null: true
}
2022-05-26 03:04:33 +04:00
},
publishedAt: {
$notNull: true,
2022-05-25 06:40:50 +04:00
}
}
})
const countParoleWithoutEspagnol = await strapi.entityService.count('api::parole.parole', {
filters: {
traductions: {
espagnol: {
$null: true
}
2022-05-26 03:04:33 +04:00
},
publishedAt: {
$notNull: true,
2022-05-25 06:40:50 +04:00
}
}
})
const countParoleWithoutAllemand = await strapi.entityService.count('api::parole.parole', {
filters: {
traductions: {
allemand: {
$null: true
}
2022-05-26 03:04:33 +04:00
},
publishedAt: {
$notNull: true,
2022-05-25 06:40:50 +04:00
}
}
})
const countParoleWithoutItalien = await strapi.entityService.count('api::parole.parole', {
filters: {
traductions: {
italien: {
$null: true
}
2022-05-26 03:04:33 +04:00
},
publishedAt: {
$notNull: true,
2022-05-25 06:40:50 +04:00
}
}
})
const artistesWithoutBio = await strapi.entityService.count('api::artiste.artiste', {
filters: {
biographie: {
$null: true
}
}
})
const parolesWithoutTranslation = {
francais: countParoleWithoutFrancais - 1, // -1 Car la transcription d'une parole est déjà en francais (Micajah - Va là-bas)
anglais: countParoleWithoutAnglais,
espagnol: countParoleWithoutEspagnol,
allemand: countParoleWithoutAllemand,
italien: countParoleWithoutItalien,
}
return {countArtiste, countParole, artistesWithoutBio, parolesWithoutTranslation}
}
}