diff --git a/src/entity/brilink_transactions.ts b/src/entity/brilink_transactions.ts index 893ec11..71bb3a3 100644 --- a/src/entity/brilink_transactions.ts +++ b/src/entity/brilink_transactions.ts @@ -1,142 +1,146 @@ -import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinTable, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'; -import { BrilinkMerchant } from './brilink_merchants'; -import { BrilinkBalanceCode, BrilinkBalanceType, BrilinkTransactionActivity, BrilinkTransactionStatus, BrilinkTransactionType } from '../types/brilink'; -import { BrilinkMerchantTerminal } from './brilink_merchant_terminals'; -import { BrilinkTerminal } from './brilink_terminals'; -import { BrilinkBalance } from './brilink_balances.ts'; -import { BrilinkBalanceMutation } from './brilink_balance_mutations'; -import { BrilinkMerchantSettlement } from './brilink_merchant_settlements'; -import { BrilinkDiscount } from './brilink_discounts'; +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinTable, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { BrilinkMerchant } from "./brilink_merchants"; +import { BrilinkBalanceCode, BrilinkBalanceType, BrilinkTransactionActivity, BrilinkTransactionStatus, BrilinkTransactionType } from "../types/brilink"; +import { BrilinkMerchantTerminal } from "./brilink_merchant_terminals"; +import { BrilinkTerminal } from "./brilink_terminals"; +import { BrilinkBalance } from "./brilink_balances.ts"; +import { BrilinkBalanceMutation } from "./brilink_balance_mutations"; +import { BrilinkMerchantSettlement } from "./brilink_merchant_settlements"; +import { BrilinkDiscount } from "./brilink_discounts"; +import { BrilinkProductItem } from "./brilink_product_items"; -@Entity('brilink_transactions', { schema: 'brilinks' }) +@Entity("brilink_transactions", { schema: "brilinks" }) export class BrilinkTransaction { - @PrimaryGeneratedColumn('uuid') - id: string; + @PrimaryGeneratedColumn("uuid") + id: string; - @ManyToOne(() => BrilinkMerchant, { onDelete: 'RESTRICT' }) - @JoinTable() - merchant: BrilinkMerchant + @ManyToOne(() => BrilinkMerchant, { onDelete: "RESTRICT" }) + @JoinTable() + merchant: BrilinkMerchant; - @ManyToOne(() => BrilinkMerchantTerminal, { onDelete: 'RESTRICT' }) - @JoinTable() - merchant_terminal: BrilinkMerchantTerminal + @ManyToOne(() => BrilinkMerchantTerminal, { onDelete: "RESTRICT" }) + @JoinTable() + merchant_terminal: BrilinkMerchantTerminal; - @ManyToOne(() => BrilinkBalanceMutation, { onDelete: 'RESTRICT', nullable: true }) - @JoinTable() - balance_mutation: BrilinkBalanceMutation + @ManyToOne(() => BrilinkBalanceMutation, { onDelete: "RESTRICT", nullable: true }) + @JoinTable() + balance_mutation: BrilinkBalanceMutation; - @Column({ - nullable: false, - length: 128 - }) - code: string; + @Column({ + nullable: false, + length: 128, + }) + code: string; - @Column({ - nullable: false, - length: 64 - }) - type: BrilinkTransactionType + @Column({ + nullable: false, + length: 64, + }) + type: BrilinkTransactionType; - @Column({ - nullable: false, - length: 64 - }) - activity: BrilinkTransactionActivity; + @Column({ + nullable: false, + length: 64, + }) + activity: BrilinkTransactionActivity; - @Column({ nullable: false }) - activity_at: Date; + @Column({ nullable: false }) + activity_at: Date; - @Column({ - length: 128, - nullable: true, - }) - target: string; + @Column({ + length: 128, + nullable: true, + }) + target: string; - @Column({ - type: 'jsonb', - nullable: true, - }) - target_data: Record; + @Column({ + type: "jsonb", + nullable: true, + }) + target_data: Record; - @Column({ - type: 'float8', - nullable: false, - default: 0 - }) - amount: number; + @Column({ + type: "float8", + nullable: false, + default: 0, + }) + amount: number; - @ManyToOne(() => BrilinkDiscount, { onDelete: 'NO ACTION', nullable: true }) - @JoinTable() - discount: BrilinkDiscount + @ManyToOne(() => BrilinkDiscount, { onDelete: "NO ACTION", nullable: true }) + @JoinTable() + discount: BrilinkDiscount; - @Column({ - type: 'float8', - nullable: false, - default: 0 - }) - discount_amount: number; + @Column({ + type: "float8", + nullable: false, + default: 0, + }) + discount_amount: number; + @Column({ + type: "float8", + nullable: false, + default: 0, + }) + fee: number; - @Column({ - type: 'float8', - nullable: false, - default: 0 - }) - fee: number; + @Column({ + type: "float8", + nullable: false, + default: 0, + }) + total: number; - @Column({ - type: 'float8', - nullable: false, - default: 0 - }) - total: number; + @Column({ + nullable: false, + length: 64, + }) + status: BrilinkTransactionStatus; - @Column({ - nullable: false, - length: 64 - }) - status: BrilinkTransactionStatus; + @Column({ + length: 128, + nullable: true, + }) + reference: string; - @Column({ - length: 128, - nullable: true, - }) - reference: string; + @Column({ + length: 1024, + nullable: true, + }) + remarks: string; - @Column({ - length: 1024, - nullable: true, - }) - remarks: string; + @Column({ + nullable: false, + default: false, + }) + is_merchant_settlement: boolean; - @Column({ - nullable: false, - default: false - }) - is_merchant_settlement: boolean; + @ManyToOne(() => BrilinkMerchantSettlement, { onDelete: "RESTRICT", nullable: true }) + @JoinTable() + merchant_settlement: BrilinkMerchantSettlement; - @ManyToOne(() => BrilinkMerchantSettlement, { onDelete: 'RESTRICT', nullable: true }) - @JoinTable() - merchant_settlement: BrilinkMerchantSettlement + @ManyToOne(() => BrilinkProductItem, { onDelete: "NO ACTION", nullable: true }) + @JoinTable() + product_item: BrilinkProductItem; - @Column() - @CreateDateColumn() - created_at: Date; + @Column() + @CreateDateColumn() + created_at: Date; - @Column({ type: "varchar", length: 255 }) - created_by: string; + @Column({ type: "varchar", length: 255 }) + created_by: string; - @Column({ nullable: true }) - @UpdateDateColumn() - updated_at: Date; + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; - @Column({ type: "varchar", length: 255, nullable: true }) - updated_by: string; + @Column({ type: "varchar", length: 255, nullable: true }) + updated_by: string; - @Column({ nullable: true }) - @DeleteDateColumn() - deleted_at: Date; + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; - @Column({ type: "varchar", length: 255, nullable: true }) - deleted_by: string; -} \ No newline at end of file + @Column({ type: "varchar", length: 255, nullable: true }) + deleted_by: string; +}