Implement that adminUpdateContribution is not allowed when moderator is null.

This commit is contained in:
elweyn 2022-07-13 08:27:05 +02:00
parent c6bab99a2c
commit 801e223cfd

View File

@ -321,6 +321,10 @@ export class AdminResolver {
throw new Error('user of the pending contribution and send user does not correspond')
}
if (contributionToUpdate.moderatorId === null) {
throw new Error('An admin is not allowed to update a user contribution.')
}
const creationDateObj = new Date(creationDate)
let creations = await getUserCreation(user.id)
if (contributionToUpdate.contributionDate.getMonth() === creationDateObj.getMonth()) {