mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Withdrew if contribution not valid statement since the method throws an exception if not valid.
This commit is contained in:
parent
a56908b8f5
commit
457016a7a7
@ -2,8 +2,9 @@ import { RIGHTS } from '@/auth/RIGHTS'
|
||||
import { Context, getUser } from '@/server/context'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
import { Contribution } from '@entity/Contribution'
|
||||
import { Args, Authorized, Ctx, Mutation, Resolver } from 'type-graphql'
|
||||
import { Args, Authorized, Ctx, Mutation, Query, Resolver } from 'type-graphql'
|
||||
import CreateContributionArgs from '../arg/CreateContributionArgs'
|
||||
import Paginated from '../arg/Paginated'
|
||||
import { getUserCreation } from './util/getUserCreation'
|
||||
import { isContributionValid } from './util/isContributionValid'
|
||||
|
||||
@ -19,9 +20,8 @@ export class ContributionResolver {
|
||||
const creations = await getUserCreation(user.id)
|
||||
logger.trace('creations', creations)
|
||||
const creationDateObj = new Date(creationDate)
|
||||
if (!isContributionValid(creations, amount, creationDateObj)) {
|
||||
throw new Error('Contribution is not valid')
|
||||
}
|
||||
isContributionValid(creations, amount, creationDateObj)
|
||||
|
||||
const contribution = Contribution.create()
|
||||
contribution.userId = user.id
|
||||
contribution.amount = amount
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user