improve matching of created pending creation, see TODO

This commit is contained in:
Moriz Wahl 2022-04-27 17:51:26 +02:00
parent e4776fcfd5
commit 6f0c3c11a5
2 changed files with 8 additions and 2 deletions

View File

@ -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' },
})

View File

@ -133,3 +133,9 @@ export const updatePendingCreation = gql`
}
}
`
export const deletePendingCreation = gql`
mutation ($id: Int!) {
deletePendingCreation(id: $id)
}
`