diff --git a/src/api/parole/content-types/parole/lifecycles.js b/src/api/parole/content-types/parole/lifecycles.js index 94eff83..130f2d7 100644 --- a/src/api/parole/content-types/parole/lifecycles.js +++ b/src/api/parole/content-types/parole/lifecycles.js @@ -144,6 +144,13 @@ module.exports = { let {data} = event.params const {documentId} = data + if (data.isNewRelease === true) { + await strapi.db.query('api::parole.parole').updateMany({ + where: { isNewRelease: true }, + data: { isNewRelease: false }, + }) + } + const previousParoles = await strapi.db.query('api::parole.parole').findOne({ where: {documentId}, populate: {difference: true, artistes: true} diff --git a/src/api/parole/content-types/parole/schema.json b/src/api/parole/content-types/parole/schema.json index 95e3356..ccfc181 100644 --- a/src/api/parole/content-types/parole/schema.json +++ b/src/api/parole/content-types/parole/schema.json @@ -142,6 +142,10 @@ "relation": "oneToMany", "target": "api::parole.parole", "mappedBy": "sourceOriginale" + }, + "isNewRelease": { + "type": "boolean", + "default": false } } } diff --git a/types/generated/contentTypes.d.ts b/types/generated/contentTypes.d.ts index 35dba52..4d2e4aa 100644 --- a/types/generated/contentTypes.d.ts +++ b/types/generated/contentTypes.d.ts @@ -540,6 +540,7 @@ export interface ApiParoleParole extends Struct.CollectionTypeSchema { >; forceSlug: Schema.Attribute.Boolean; gadeEmbed: Schema.Attribute.String; + isNewRelease: Schema.Attribute.Boolean & Schema.Attribute.DefaultTo; langueSource: Schema.Attribute.Enumeration< ['ka', 'fr', 'en', 'es', 'de', 'it'] > &