68 lines
1.2 KiB
TypeScript
68 lines
1.2 KiB
TypeScript
import { ApiProperty } from '@midwayjs/swagger';
|
|
import { Exclude, Expose } from 'class-transformer';
|
|
import {
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
JoinColumn,
|
|
ManyToOne,
|
|
PrimaryGeneratedColumn,
|
|
UpdateDateColumn,
|
|
} from 'typeorm';
|
|
import { Shipment } from './shipment.entity';
|
|
import { Order } from './order.entity';
|
|
|
|
@Entity('shipment_item')
|
|
@Exclude()
|
|
export class ShipmentItem {
|
|
@ApiProperty()
|
|
@PrimaryGeneratedColumn()
|
|
@Expose()
|
|
id: number;
|
|
|
|
@ApiProperty()
|
|
@Expose()
|
|
@ManyToOne(() => Shipment)
|
|
@JoinColumn({ name: 'shipment_id' })
|
|
shipment_id: number;
|
|
|
|
@ApiProperty()
|
|
@Expose()
|
|
@ManyToOne(() => Order)
|
|
@JoinColumn({ name: 'order_id' })
|
|
order_id: number;
|
|
|
|
@ApiProperty()
|
|
@Column({ nullable: true })
|
|
@Expose()
|
|
name: string;
|
|
|
|
@ApiProperty({ description: 'sku', type: 'string' })
|
|
@Expose()
|
|
@Column()
|
|
sku: string;
|
|
|
|
@ApiProperty()
|
|
@Column()
|
|
@Expose()
|
|
quantity: number;
|
|
|
|
@ApiProperty({
|
|
example: '2022-12-12 11:11:11',
|
|
description: '创建时间',
|
|
required: true,
|
|
})
|
|
@CreateDateColumn()
|
|
@Expose()
|
|
createdAt: Date;
|
|
|
|
@ApiProperty({
|
|
example: '2022-12-12 11:11:11',
|
|
description: '更新时间',
|
|
required: true,
|
|
})
|
|
@UpdateDateColumn()
|
|
@Expose()
|
|
updatedAt: Date;
|
|
}
|