From 922749d3966ec17d034dfacc5f5c298c1e1b42f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Sun, 15 May 2022 00:12:31 +0400 Subject: [PATCH] Fix validateParoles beforeUpdate --- src/api/parole/content-types/parole/lifecycles.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/api/parole/content-types/parole/lifecycles.js b/src/api/parole/content-types/parole/lifecycles.js index 12b61bc..d2937b7 100644 --- a/src/api/parole/content-types/parole/lifecycles.js +++ b/src/api/parole/content-types/parole/lifecycles.js @@ -135,11 +135,15 @@ module.exports = { }, beforeUpdate: async event => { - let {data} = event.params - validateParoles(data.titre, data.transcription) - + let {data} = event.params const {where} = event.params + const currentData = await strapi.db.query('api::parole.parole').findOne({ + where: {id: where.id} + }) + + validateParoles(currentData.titre, currentData.transcription) + if(!data.publishedAt) { if (data.tit && !data.forceSlug) { const artiste = await jwennAwtisEpiId(data.artistes)