add supplier entity
This commit is contained in:
@ -7,11 +7,12 @@ import {
|
|||||||
DeleteDateColumn,
|
DeleteDateColumn,
|
||||||
Index,
|
Index,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
JoinColumn
|
JoinColumn,
|
||||||
} from 'typeorm';
|
} from 'typeorm';
|
||||||
|
|
||||||
import { Status } from '../types/status';
|
import { Status } from '../types/status';
|
||||||
import { User } from './users';
|
import { User } from './users';
|
||||||
|
import { Supplier } from './supplier';
|
||||||
|
|
||||||
@Entity('goods')
|
@Entity('goods')
|
||||||
export class Goods {
|
export class Goods {
|
||||||
@ -19,34 +20,34 @@ export class Goods {
|
|||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: false,
|
nullable: false,
|
||||||
length: 128,
|
length: 128,
|
||||||
})
|
})
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
length: 255,
|
length: 255,
|
||||||
})
|
})
|
||||||
description: string;
|
description: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: false,
|
nullable: false,
|
||||||
type: 'decimal',
|
type: 'decimal',
|
||||||
precision: 10,
|
precision: 10,
|
||||||
scale: 2,
|
scale: 2,
|
||||||
})
|
})
|
||||||
price: number;
|
price: number;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
type: 'int',
|
type: 'int',
|
||||||
})
|
})
|
||||||
quantity: number;
|
quantity: number;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
type: 'uuid',
|
type: 'uuid',
|
||||||
})
|
})
|
||||||
category_id: string;
|
category_id: string;
|
||||||
|
|
||||||
@ -56,14 +57,25 @@ export class Goods {
|
|||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
type: 'uuid',
|
type: 'uuid',
|
||||||
})
|
})
|
||||||
created_by: string;
|
created_by: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => Supplier, { nullable: false })
|
||||||
|
@JoinColumn({ name: 'supplier_id' })
|
||||||
|
supplier: Supplier;
|
||||||
|
|
||||||
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
nullable: false,
|
nullable: false,
|
||||||
length: 64,
|
type: 'uuid',
|
||||||
|
})
|
||||||
|
supplier_id: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 64,
|
||||||
})
|
})
|
||||||
status: Status;
|
status: Status;
|
||||||
|
|
||||||
|
|||||||
68
src/entity/supplier.ts
Normal file
68
src/entity/supplier.ts
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
} from 'typeorm';
|
||||||
|
|
||||||
|
@Entity('suppliers')
|
||||||
|
export class Supplier {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 128,
|
||||||
|
})
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 255,
|
||||||
|
})
|
||||||
|
description: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 128,
|
||||||
|
})
|
||||||
|
contact_person: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 128,
|
||||||
|
})
|
||||||
|
email: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 15,
|
||||||
|
})
|
||||||
|
phone: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 255,
|
||||||
|
})
|
||||||
|
address: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 64,
|
||||||
|
})
|
||||||
|
status: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
}
|
||||||
@ -36,6 +36,7 @@ import { Summarize } from "./entity/summarizes";
|
|||||||
import { SummarizeLog } from "./entity/summarize_log";
|
import { SummarizeLog } from "./entity/summarize_log";
|
||||||
import { SummarizeLogStatus, SummarizeType } from "./types/summarize";
|
import { SummarizeLogStatus, SummarizeType } from "./types/summarize";
|
||||||
import { Goods } from "./entity/goods";
|
import { Goods } from "./entity/goods";
|
||||||
|
import { Supplier } from "./entity/supplier";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
User, //
|
User, //
|
||||||
@ -78,5 +79,6 @@ export {
|
|||||||
SummarizeLog,
|
SummarizeLog,
|
||||||
SummarizeLogStatus,
|
SummarizeLogStatus,
|
||||||
SummarizeType,
|
SummarizeType,
|
||||||
Goods
|
Goods,
|
||||||
|
Supplier
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user