From 7a168f54ff386783a7e9e6eb894fed819564f77a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Tue, 28 Apr 2026 12:30:29 +0400 Subject: [PATCH] fix: use documentId --- src/api/artiste/controllers/artiste.js | 2 +- src/api/commentaire/controllers/commentaire.js | 6 +++--- src/api/parole/controllers/parole.js | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/api/artiste/controllers/artiste.js b/src/api/artiste/controllers/artiste.js index 4e2bc1b..b3bee3b 100644 --- a/src/api/artiste/controllers/artiste.js +++ b/src/api/artiste/controllers/artiste.js @@ -27,7 +27,7 @@ module.exports = createCoreController('api::artiste.artiste', ({strapi}) => ({ } const user = await strapi.documents('plugin::users-permissions.user').findOne({ - documentId: "__TODO__" + documentId: body.data.user.documentId }) if (!user) { diff --git a/src/api/commentaire/controllers/commentaire.js b/src/api/commentaire/controllers/commentaire.js index bb83956..806e563 100644 --- a/src/api/commentaire/controllers/commentaire.js +++ b/src/api/commentaire/controllers/commentaire.js @@ -22,7 +22,7 @@ module.exports = createCoreController('api::commentaire.commentaire', ({strapi}) } } const user = await strapi.documents('plugin::users-permissions.user').findOne({ - documentId: "__TODO__" + documentId: data.user.documentId }) if (!user) { @@ -36,7 +36,7 @@ module.exports = createCoreController('api::commentaire.commentaire', ({strapi}) data.user = user.id const parole = await strapi.documents('api::parole.parole').findOne({ - documentId: "__TODO__", + documentId: user.documentId, fields: ['id'] }) @@ -51,7 +51,7 @@ module.exports = createCoreController('api::commentaire.commentaire', ({strapi}) }) await strapi.documents('api::parole.parole').update({ - documentId: "__TODO__", + documentId: user.documentId, data: { commentaires: [newCommentaire.id] diff --git a/src/api/parole/controllers/parole.js b/src/api/parole/controllers/parole.js index 23f2081..c5aa1ae 100644 --- a/src/api/parole/controllers/parole.js +++ b/src/api/parole/controllers/parole.js @@ -3,12 +3,12 @@ const { createCoreController } = require('@strapi/strapi').factories; module.exports = createCoreController('api::parole.parole', ({strapi}) => ({ - async findOne(ctx) { - const {id} = ctx.params + async findOne(documentId) { const parole = await strapi.documents('api::parole.parole').findOne({ - documentId: "__TODO__", + documentId, populate: ['artistes'] }) + return parole }, async update(ctx) { @@ -16,7 +16,7 @@ module.exports = createCoreController('api::parole.parole', ({strapi}) => ({ const {data} = body const updatedParole = await strapi.documents('api::parole.parole').update({ - documentId: "__TODO__", + documentId: data.documentId, data: { ...data @@ -45,7 +45,7 @@ module.exports = createCoreController('api::parole.parole', ({strapi}) => ({ } const user = await strapi.documents('plugin::users-permissions.user').findOne({ - documentId: "__TODO__" + documentId: body.data.user.documentId }) if (!user) { @@ -57,7 +57,7 @@ module.exports = createCoreController('api::parole.parole', ({strapi}) => ({ } const artiste = await strapi.documents('api::artiste.artiste').findOne({ - documentId: "__TODO__" + documentId: data.artistes[0].documentId }) if (!artiste) { @@ -94,7 +94,7 @@ module.exports = createCoreController('api::parole.parole', ({strapi}) => ({ parolesIds.push(newParole.id) await strapi.documents('plugin::users-permissions.user').update({ - documentId: "__TODO__", + documentId: user.documentId, data: { paroles: parolesIds