fix: whitelister les champs autorisés sur create/update (mass assignment)
This commit is contained in:
@@ -24,8 +24,6 @@ module.exports = createCoreController('api::commentaire.commentaire', ({strapi})
|
||||
throw new ApplicationError('Informations non valides.')
|
||||
}
|
||||
|
||||
data.user = user.id
|
||||
|
||||
const parole = await strapi.db.query('api::parole.parole').findOne({
|
||||
where: {id: data.parole}
|
||||
})
|
||||
@@ -36,7 +34,10 @@ module.exports = createCoreController('api::commentaire.commentaire', ({strapi})
|
||||
|
||||
const newCommentaire = await strapi.documents('api::commentaire.commentaire').create({
|
||||
data: {
|
||||
...data
|
||||
contenu: data.contenu,
|
||||
datePublication: data.datePublication,
|
||||
user: user.id,
|
||||
parole: parole.id
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user