mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
change using findUserByEmail() instead of raw queries
This commit is contained in:
parent
4e07aeaff1
commit
bb8fc6a16e
@ -8,7 +8,7 @@ import { CreationInterface } from '@/seeds/creation/CreationInterface'
|
|||||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||||
import { Transaction } from '@entity/Transaction'
|
import { Transaction } from '@entity/Transaction'
|
||||||
import { Contribution } from '@entity/Contribution'
|
import { Contribution } from '@entity/Contribution'
|
||||||
import { UserContact } from '@entity/UserContact'
|
import { findUserByEmail } from '@/graphql/resolver/UserResolver'
|
||||||
// import CONFIG from '@/config/index'
|
// import CONFIG from '@/config/index'
|
||||||
|
|
||||||
export const nMonthsBefore = (date: Date, months = 1): string => {
|
export const nMonthsBefore = (date: Date, months = 1): string => {
|
||||||
@ -27,12 +27,7 @@ export const creationFactory = async (
|
|||||||
await mutate({ mutation: adminCreateContribution, variables: { ...creation } })
|
await mutate({ mutation: adminCreateContribution, variables: { ...creation } })
|
||||||
logger.trace('creationFactory... after adminCreateContribution')
|
logger.trace('creationFactory... after adminCreateContribution')
|
||||||
|
|
||||||
const userContact = await UserContact.findOneOrFail({
|
const user = await findUserByEmail(creation.email) // userContact.user
|
||||||
where: { email: creation.email },
|
|
||||||
relations: ['user'],
|
|
||||||
})
|
|
||||||
logger.trace('creationFactory... after UserContact.findOneOrFail userContact=', userContact)
|
|
||||||
const user = userContact.user
|
|
||||||
|
|
||||||
const pendingCreation = await Contribution.findOneOrFail({
|
const pendingCreation = await Contribution.findOneOrFail({
|
||||||
where: { userId: user.id, amount: creation.amount },
|
where: { userId: user.id, amount: creation.amount },
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user