mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
27 lines
795 B
TypeScript
27 lines
795 B
TypeScript
import { ObjectType, Field } from 'type-graphql'
|
|
import { TransactionError } from './TransactionError'
|
|
import { TransactionRecipe } from './TransactionRecipe'
|
|
|
|
@ObjectType()
|
|
export class TransactionResult {
|
|
constructor(content?: TransactionError | TransactionRecipe) {
|
|
this.succeed = true
|
|
if (content instanceof TransactionError) {
|
|
this.error = content
|
|
this.succeed = false
|
|
} else if (content instanceof TransactionRecipe) {
|
|
this.recipe = content
|
|
}
|
|
}
|
|
|
|
// the error if one happened
|
|
@Field(() => TransactionError, { nullable: true })
|
|
error?: TransactionError
|
|
|
|
// if no error happend, the message id of the iota transaction
|
|
@Field(() => TransactionRecipe, { nullable: true })
|
|
recipe?: TransactionRecipe
|
|
|
|
@Field(() => Boolean)
|
|
succeed: boolean
|
|
} |