From eb5b19e6d6e01babe373fc8309621b7996d566f4 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 9 Mar 2022 12:02:10 +0100 Subject: [PATCH] add code column to model and entity --- backend/src/graphql/model/TransactionLink.ts | 3 +++ database/entity/0030-transaction_link/TransactionLink.ts | 5 ++++- database/migrations/0030-transaction_link.ts | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/src/graphql/model/TransactionLink.ts b/backend/src/graphql/model/TransactionLink.ts index 4511c5cdd..c46728407 100644 --- a/backend/src/graphql/model/TransactionLink.ts +++ b/backend/src/graphql/model/TransactionLink.ts @@ -16,6 +16,9 @@ export class TransactionLink { @Field(() => String) memo: string + @Field(() => String) + code: string + @Field(() => Date) createdAt: Date diff --git a/database/entity/0030-transaction_link/TransactionLink.ts b/database/entity/0030-transaction_link/TransactionLink.ts index 11f1be6a3..d04c00d7b 100644 --- a/database/entity/0030-transaction_link/TransactionLink.ts +++ b/database/entity/0030-transaction_link/TransactionLink.ts @@ -3,7 +3,7 @@ import { BaseEntity, Entity, PrimaryGeneratedColumn, Column } from 'typeorm' import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' @Entity('transaction_links') -export class Transaction extends BaseEntity { +export class TransactionLink extends BaseEntity { @PrimaryGeneratedColumn('increment', { unsigned: true }) id: number @@ -22,6 +22,9 @@ export class Transaction extends BaseEntity { @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) memo: string + @Column({ length: 96, nullable: false, collation: 'utf8mb4_unicode_ci' }) + code: string + @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP', diff --git a/database/migrations/0030-transaction_link.ts b/database/migrations/0030-transaction_link.ts index ca0f0cfa5..59eba1090 100644 --- a/database/migrations/0030-transaction_link.ts +++ b/database/migrations/0030-transaction_link.ts @@ -10,6 +10,7 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis \`userId\` int UNSIGNED NOT NULL, \`amount\` DECIMAL(40,20) NOT NULL, \`memo\` varchar(255) NOT NULL, + \`code\` varchar(96) NOT NULL, \`createdAt\` datetime NOT NULL, \`validUntil\` datetime NOT NULL, \`showEmail\` boolean NOT NULL DEFAULT false,