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

121 lines
2.7 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({ nullable: true })
@Expose()
parentProductId?: number; // 父产品 ID 用于统计套餐 如果是单品则不记录
@ApiProperty({name: "产品 ID"})
@Column()
@Expose()
productId: number;
@ApiProperty()
@Column()
@Expose()
name: string;
@ApiProperty({ description: 'sku', type: 'string' })
@Expose()
@Column()
sku: string;// 库存产品sku
@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;
}