From 0600996142467022701d30a18c39cdbc05e828f1 Mon Sep 17 00:00:00 2001 From: Abdul Rahman Reza Date: Sat, 30 Nov 2024 15:16:36 +0700 Subject: [PATCH] update entity branch & product --- src/entity/branchs.ts | 40 ++++++++++++++++++++++++++++++++++++ src/entity/products.ts | 46 ++++++++++++++++++++++++++++++++++++++++++ src/index.ts | 6 +++++- 3 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 src/entity/branchs.ts create mode 100644 src/entity/products.ts diff --git a/src/entity/branchs.ts b/src/entity/branchs.ts new file mode 100644 index 0000000..ff23b8f --- /dev/null +++ b/src/entity/branchs.ts @@ -0,0 +1,40 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index } from 'typeorm'; + +import { Status } from '../types/status'; + +@Entity('branchs') +export class Branch { + @PrimaryGeneratedColumn('uuid') + id: string; + + @Column({ + nullable: false, + unique: true, + length: 6 + }) + code: string; + + @Column({ + nullable: true, + length: 256 + }) + name: string; + + @Column({ + nullable: false, + length: 64 + }) + status: Status; + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; + + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; +} \ No newline at end of file diff --git a/src/entity/products.ts b/src/entity/products.ts new file mode 100644 index 0000000..4ca0b56 --- /dev/null +++ b/src/entity/products.ts @@ -0,0 +1,46 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index } from 'typeorm'; + +import { Status } from '../types/status'; + +@Entity('products') +export class Product { + @PrimaryGeneratedColumn('uuid') + id: string; + + @Column({ + nullable: false, + unique: true, + length: 6 + }) + code: number; + + @Column({ + nullable: true, + length: 256 + }) + name: string; + + @Column({ + nullable: true, + length: 4096 + }) + description: string; + + @Column({ + nullable: false, + length: 64 + }) + status: Status; + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; + + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 276a386..6b58c34 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,6 +11,8 @@ import { Paging } from "./types/paging"; import { RoleList } from "./types/role"; import { Status } from "./types/status"; import { EmailBody } from "./types/email"; +import { Branch } from "./entity/branchs"; +import { Product } from "./entity/products"; export { User, @@ -26,5 +28,7 @@ export { Paging, RoleList, Status, - EmailBody + EmailBody, + Product, + Branch }; \ No newline at end of file