From b4a4a9e12699ce49ba77bafe927a0f460b874d09 Mon Sep 17 00:00:00 2001 From: elweyn Date: Tue, 19 Jul 2022 13:09:03 +0200 Subject: [PATCH] Throw error if confirmedAt is present. --- backend/src/graphql/resolver/ContributionResolver.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index 8ee994989..ef4467a71 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -52,6 +52,9 @@ export class ContributionResolver { if (contribution.userId !== user.id) { throw new Error('Can not delete contribution of another user') } + if (contribution.confirmedAt) { + throw new Error('A confirmed contribution can not be deleted') + } const res = await contribution.softRemove() return !!res }