forked from yoone/API
116 lines
2.5 KiB
TypeScript
116 lines
2.5 KiB
TypeScript
import { ApiProperty } from '@midwayjs/swagger';
|
|
import { Exclude, Expose } from 'class-transformer';
|
|
import {
|
|
// BeforeInsert,
|
|
// BeforeUpdate,
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
PrimaryGeneratedColumn,
|
|
UpdateDateColumn,
|
|
} from 'typeorm';
|
|
// import { Product } from './product.entity';
|
|
|
|
@Entity('order_sale')
|
|
@Exclude()
|
|
export class OrderSale {
|
|
// @ManyToOne(() => Product, { onDelete: 'CASCADE' })
|
|
// @JoinColumn({ name: 'productId' })
|
|
// product: Product;
|
|
@ApiProperty()
|
|
@PrimaryGeneratedColumn()
|
|
@Expose()
|
|
id?: number;
|
|
|
|
@ApiProperty({ name:'原始订单ID' })
|
|
@Column()
|
|
@Expose()
|
|
orderId: number; // 订单 ID
|
|
|
|
@ApiProperty({ name:'站点' })
|
|
@Column()
|
|
@Expose()
|
|
siteId: number; // 来源站点唯一标识
|
|
|
|
@ApiProperty({name: "原始订单 itemId"})
|
|
@Column({ nullable: true })
|
|
@Expose()
|
|
externalOrderItemId: string; // WooCommerce 订单item ID
|
|
|
|
@ApiProperty({name: "产品 ID"})
|
|
@Column()
|
|
@Expose()
|
|
productId: number;
|
|
|
|
@ApiProperty()
|
|
@Column()
|
|
@Expose()
|
|
name: string;
|
|
|
|
@ApiProperty({ description: 'sku', type: 'string' })
|
|
@Expose()
|
|
@Column()
|
|
sku: string;
|
|
|
|
@ApiProperty()
|
|
@Column()
|
|
@Expose()
|
|
quantity: number;
|
|
|
|
@ApiProperty()
|
|
@Column({ default: false })
|
|
@Expose()
|
|
isPackage: boolean;
|
|
|
|
@ApiProperty({ description: '商品品类', type: 'string',nullable: true})
|
|
@Expose()
|
|
@Column({ nullable: true })
|
|
category?: string;
|
|
// TODO 这个其实还是直接保存 product 比较好
|
|
@ApiProperty({ description: '品牌', type: 'string',nullable: true})
|
|
@Expose()
|
|
@Column({ nullable: true })
|
|
brand?: string;
|
|
|
|
@ApiProperty({ description: '口味', type: 'string', nullable: true })
|
|
@Expose()
|
|
@Column({ nullable: true })
|
|
flavor?: string;
|
|
|
|
@ApiProperty({ description: '湿度', type: 'string', nullable: true })
|
|
@Expose()
|
|
@Column({ nullable: true })
|
|
humidity?: string;
|
|
|
|
@ApiProperty({ description: '尺寸', type: 'string', nullable: true })
|
|
@Expose()
|
|
@Column({ nullable: true })
|
|
size?: string;
|
|
|
|
@ApiProperty({name: '强度', nullable: true })
|
|
@Column({ nullable: true })
|
|
@Expose()
|
|
strength: string | null;
|
|
|
|
@ApiProperty({ description: '版本', type: 'string', nullable: true })
|
|
@Expose()
|
|
@Column({ nullable: true })
|
|
version?: string;
|
|
|
|
@ApiProperty({
|
|
example: '2022-12-12 11:11:11',
|
|
description: '创建时间',
|
|
})
|
|
@CreateDateColumn()
|
|
@Expose()
|
|
createdAt?: Date;
|
|
|
|
@ApiProperty({
|
|
example: '2022-12-12 11:11:11',
|
|
description: '更新时间',
|
|
})
|
|
@UpdateDateColumn()
|
|
@Expose()
|
|
updatedAt?: Date;
|
|
}
|