zksu
/
API
forked from yoone/API
1
0
Fork 0
API/src/entity/stock_point.entity.ts

87 lines
1.6 KiB
TypeScript

import { ApiProperty } from '@midwayjs/swagger';
import {
BaseEntity,
Column,
CreateDateColumn,
DeleteDateColumn,
Entity,
PrimaryGeneratedColumn,
UpdateDateColumn,
OneToMany,
ManyToMany,
JoinTable,
} from 'typeorm';
import { Shipment } from './shipment.entity';
import { Area } from './area.entity';
import { Site } from './site.entity';
@Entity('stock_point')
export class StockPoint extends BaseEntity {
@ApiProperty({ type: 'number' })
@PrimaryGeneratedColumn()
id: number;
@OneToMany(() => Shipment, shipment => shipment.stockPoint)
shipments: Shipment[];
@ApiProperty({ type: 'string' })
@Column()
name: string;
@ApiProperty({ type: 'string' })
@Column()
location: string;
@ApiProperty({ type: 'string' })
@Column()
contactPerson: string;
@ApiProperty({ type: 'string' })
@Column()
contactPhone: string;
@ApiProperty()
@Column({ default: false })
ignore: boolean;
@ApiProperty()
@Column({ default: false })
inCanada: boolean;
@ApiProperty()
@Column({ default: false })
isB: boolean;
@Column({ default: 'uniuni' })
upStreamName: string;
@Column({ default: 0 })
upStreamStockPointId: number;
@ApiProperty({
example: '2022-12-12 11:11:11',
description: '创建时间',
required: true,
})
@CreateDateColumn()
createdAt: Date;
@ApiProperty({
example: '2022-12-12 11:11:11',
description: '更新时间',
required: true,
})
@UpdateDateColumn()
updatedAt: Date;
@DeleteDateColumn()
deletedAt: Date; // 软删除时间
@ManyToMany(() => Area)
@JoinTable()
areas: Area[];
@ManyToMany(() => Site, site => site.stockPoints)
sites: Site[];
}