mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
simple createContributionLink mutation
This commit is contained in:
parent
bd593e96ae
commit
1e0b246252
@ -24,6 +24,6 @@ export default class ContributionLinkArgs {
|
||||
@Field(() => Decimal, { nullable: true })
|
||||
maxAmountPerMonth: Decimal | null
|
||||
|
||||
@Field(() => Int, { default: 1 })
|
||||
@Field(() => Int)
|
||||
maxPerCycle: number
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ export class ContributionLink {
|
||||
@Field(() => Decimal, { nullable: true })
|
||||
maxAmountPerMonth: Decimal | null
|
||||
|
||||
@Field(() => string)
|
||||
@Field(() => String)
|
||||
cycle: string
|
||||
|
||||
@Field(() => Int)
|
||||
|
||||
@ -468,9 +468,30 @@ export class AdminResolver {
|
||||
@Mutation(() => ContributionLink)
|
||||
async createContributionLink(
|
||||
@Args()
|
||||
{ amount, name, memo, cycle, validFrom, validTo, maxAmountPerMonth, maxPerCycle }: ContributionLinkArgs,
|
||||
)
|
||||
|
||||
{
|
||||
amount,
|
||||
name,
|
||||
memo,
|
||||
cycle,
|
||||
validFrom,
|
||||
validTo,
|
||||
maxAmountPerMonth,
|
||||
maxPerCycle,
|
||||
}: ContributionLinkArgs,
|
||||
): Promise<ContributionLink> {
|
||||
const dbContributionLink = new DbContributionLink()
|
||||
dbContributionLink.amount = amount
|
||||
dbContributionLink.name = name
|
||||
dbContributionLink.memo = memo
|
||||
dbContributionLink.createdAt = new Date()
|
||||
dbContributionLink.cycle = cycle
|
||||
if (validFrom) dbContributionLink.validFrom = validFrom
|
||||
if (validTo) dbContributionLink.validTo = validTo
|
||||
dbContributionLink.maxAmountPerMonth = maxAmountPerMonth
|
||||
dbContributionLink.maxPerCycle = maxPerCycle
|
||||
dbContributionLink.save()
|
||||
return new ContributionLink(dbContributionLink)
|
||||
}
|
||||
}
|
||||
|
||||
interface CreationMap {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user