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

128 lines
2.4 KiB
TypeScript

import { ApiProperty } from '@midwayjs/swagger';
import { Exclude, Expose } from 'class-transformer';
import {
Column,
CreateDateColumn,
Entity,
PrimaryGeneratedColumn,
UpdateDateColumn,
ManyToOne,
OneToOne,
JoinColumn
} from 'typeorm';
import { StockPoint } from './stock_point.entity';
import { Order } from './order.entity';
@Entity('shipment')
@Exclude()
export class Shipment {
@ApiProperty()
@PrimaryGeneratedColumn()
@Expose()
id: string;
@ApiProperty()
@OneToOne(() => Order)
@JoinColumn({ name: 'order_id' })
order: Order;
@ApiProperty()
@Column({ name: 'stock_point_id' })
@Expose()
stockPointId: string;
@ManyToOne(() => StockPoint)
@JoinColumn({ name: 'stock_point_id' })
stockPoint: StockPoint;
@Column({ nullable: false, default: 0})
@Expose()
fee: number;
@ApiProperty()
@Column({ nullable: true })
@Expose()
tracking_provider?: string;
@ApiProperty()
@Column()
@Expose()
unique_id: string;
@Column({ nullable: true })
@Expose()
state?: string;
@Column({ nullable: true })
@Expose()
type?: string;
@ApiProperty()
@Column({ nullable: true })
@Expose()
transaction_number?: string;
@ApiProperty()
@Column({ nullable: true })
@Expose()
primary_tracking_number?: string;
@ApiProperty({ type: [String] })
@Column({ type: 'json', nullable: true })
@Expose()
tracking_numbers?: string[];
@ApiProperty()
@Column({ nullable: true })
@Expose()
tracking_url?: string;
@ApiProperty()
@Column({ nullable: true })
@Expose()
return_tracking_number?: string;
@ApiProperty()
@Column({ nullable: true })
@Expose()
bol_number?: string;
@ApiProperty()
@Column({ nullable: true })
@Expose()
pickup_confirmation_number?: string;
@ApiProperty()
@Column({ nullable: true })
@Expose()
customs_invoice_url?: string;
@ApiProperty({ type: Object })
@Column({ type: 'json', nullable: true })
@Expose()
rate?: Record<string, any>;
@ApiProperty()
@Column({ type: 'json', nullable: true })
@Expose()
labels?: Array<any>;
@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;
}