Fix creating error
This commit is contained in:
@@ -189,26 +189,28 @@ module.exports = {
|
||||
const user = await jwennUserEpiId(data?.user?.id)
|
||||
const userAdmin = await jwennUserAdminEpiId(data?.createdBy)
|
||||
const superAdmin = await jwennSuperAdminEpiId(data?.createdBy)
|
||||
const traductionsId = data.traductions.id
|
||||
const traductionsId = data?.traductions?.id
|
||||
|
||||
const result = await strapi.db.query('api::parole.parole').findOne({
|
||||
where: {
|
||||
traductions: {
|
||||
id: {
|
||||
$eq: traductionsId
|
||||
if (traductionsId) {
|
||||
const result = await strapi.db.query('api::parole.parole').findOne({
|
||||
where: {
|
||||
traductions: {
|
||||
id: {
|
||||
$eq: traductionsId
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
populate: {traductions: true, artistes: true}
|
||||
})
|
||||
|
||||
if (superAdmin && data.traductionAuto && result.traductions.francais && (!result.traductions.anglais || !result.traductions.espagnol || !result.traductions.allemand || !result.traductions.italien)) {
|
||||
const traductions = await strapi.service('api::parole.parole').translateLyrics(result.traductions.francais)
|
||||
await strapi.entityService.update('api::parole.parole', result.id, {
|
||||
data: {
|
||||
traductions
|
||||
}
|
||||
},
|
||||
populate: {traductions: true, artistes: true}
|
||||
})
|
||||
|
||||
if (superAdmin && data.traductionAuto && result.traductions.francais && (!result.traductions.anglais || !result.traductions.espagnol || !result.traductions.allemand || !result.traductions.italien)) {
|
||||
const traductions = await strapi.service('api::parole.parole').translateLyrics(result.traductions.francais)
|
||||
await strapi.entityService.update('api::parole.parole', result.id, {
|
||||
data: {
|
||||
traductions
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (user) {
|
||||
|
||||
Reference in New Issue
Block a user