From 87c11a3416a3a83875be15b6b52e23fa005fb3f1 Mon Sep 17 00:00:00 2001 From: fadlydev Date: Thu, 30 Jan 2025 18:24:17 +0700 Subject: [PATCH] add requested, quantity discrepancy, and status enum --- src/entity/goods_receipt.ts | 50 ++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/src/entity/goods_receipt.ts b/src/entity/goods_receipt.ts index 55af194..cdba296 100644 --- a/src/entity/goods_receipt.ts +++ b/src/entity/goods_receipt.ts @@ -7,6 +7,12 @@ import { DeleteDateColumn } from 'typeorm'; +export enum GoodsReceiptStatus { + PENDING = 'PENDING', + RECEIVED = 'RECEIVED', + REJECTED = 'REJECTED', +} + @Entity('goods_receipts') export class GoodsReceipt { @PrimaryGeneratedColumn('uuid') @@ -38,15 +44,51 @@ export class GoodsReceipt { @Column({ nullable: true, - type: 'text', + type: 'varchar', }) - remarks: string; + requested_by: string; + + @Column({ + nullable: true, + type: 'decimal', + precision: 15, + scale: 2, + }) + nominal: number; @Column({ nullable: false, - length: 64, + type: 'int', }) - status: string; + requested_quantity: number; + + @Column({ + nullable: false, + type: 'int', + default: 0, + }) + quantity_received: number; + + @Column({ + nullable: false, + type: 'int', + default: 0, + }) + quantity_remaining: number; + + @Column({ + nullable: false, + type: 'boolean', + default: false, + }) + finalized: boolean; + + @Column({ + type: 'enum', + enum: GoodsReceiptStatus, + default: GoodsReceiptStatus.PENDING, + }) + status: GoodsReceiptStatus; @Column() @CreateDateColumn()