From 6f0c3c11a5aa6b0094173cfe6b5fdd3bcd9ac75e Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 27 Apr 2022 17:51:26 +0200 Subject: [PATCH] improve matching of created pending creation, see TODO --- backend/src/seeds/factory/creation.ts | 4 ++-- backend/src/seeds/graphql/mutations.ts | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/backend/src/seeds/factory/creation.ts b/backend/src/seeds/factory/creation.ts index 3c319fb9f..e49be3758 100644 --- a/backend/src/seeds/factory/creation.ts +++ b/backend/src/seeds/factory/creation.ts @@ -22,13 +22,13 @@ export const creationFactory = async ( await query({ query: login, variables: { email: 'peter@lustig.de', password: 'Aa12345_' } }) + // TODO it would be nice to have this mutation return the id await mutate({ mutation: createPendingCreation, variables: { ...creation } }) - // get User const user = await User.findOneOrFail({ where: { email: creation.email } }) const pendingCreation = await AdminPendingCreation.findOneOrFail({ - where: { userId: user.id }, + where: { userId: user.id, amount: creation.amount }, order: { created: 'DESC' }, }) diff --git a/backend/src/seeds/graphql/mutations.ts b/backend/src/seeds/graphql/mutations.ts index e68ba13d0..d3026dbdd 100644 --- a/backend/src/seeds/graphql/mutations.ts +++ b/backend/src/seeds/graphql/mutations.ts @@ -133,3 +133,9 @@ export const updatePendingCreation = gql` } } ` + +export const deletePendingCreation = gql` + mutation ($id: Int!) { + deletePendingCreation(id: $id) + } +`