mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
56 lines
1.3 KiB
TypeScript
56 lines
1.3 KiB
TypeScript
import { Decimal } from 'decimal.js-light'
|
|
import { Field, ObjectType } from 'type-graphql'
|
|
|
|
import { RedeemJwtPayloadType } from 'shared'
|
|
|
|
import { Community } from './Community'
|
|
import { User } from './User'
|
|
|
|
@ObjectType()
|
|
export class RedeemJwtLink {
|
|
constructor(
|
|
redeemJwtPayload: RedeemJwtPayloadType,
|
|
senderCommunity: Community,
|
|
senderUser: User,
|
|
recipientCommunity: Community,
|
|
recipientUser?: User,
|
|
) {
|
|
this.senderCommunity = senderCommunity
|
|
this.recipientCommunity = recipientCommunity
|
|
this.senderUser = senderUser
|
|
if (recipientUser !== undefined) {
|
|
this.recipientUser = recipientUser
|
|
} else {
|
|
this.recipientUser = null
|
|
}
|
|
this.amount = new Decimal(redeemJwtPayload.amount)
|
|
this.memo = redeemJwtPayload.memo
|
|
this.code = redeemJwtPayload.redeemcode
|
|
this.validUntil = new Date(redeemJwtPayload.validuntil)
|
|
}
|
|
|
|
@Field(() => Community)
|
|
senderCommunity: Community
|
|
|
|
@Field(() => User)
|
|
senderUser: User
|
|
|
|
@Field(() => Community)
|
|
recipientCommunity: Community
|
|
|
|
@Field(() => User, { nullable: true })
|
|
recipientUser: User | null
|
|
|
|
@Field(() => Decimal)
|
|
amount: Decimal
|
|
|
|
@Field(() => String)
|
|
memo: string
|
|
|
|
@Field(() => String)
|
|
code: string
|
|
|
|
@Field(() => Date)
|
|
validUntil: Date
|
|
}
|