forked from yoone/API
74 lines
1.3 KiB
TypeScript
74 lines
1.3 KiB
TypeScript
import {
|
|
PrimaryGeneratedColumn,
|
|
Column,
|
|
CreateDateColumn,
|
|
UpdateDateColumn,
|
|
Entity,
|
|
} from 'typeorm';
|
|
import { ApiProperty } from '@midwayjs/swagger';
|
|
|
|
@Entity()
|
|
export class Product {
|
|
@ApiProperty({
|
|
example: '1',
|
|
description: 'ID',
|
|
type: 'number',
|
|
required: true,
|
|
})
|
|
@PrimaryGeneratedColumn()
|
|
id: number;
|
|
|
|
@ApiProperty({
|
|
example: 'ZYN 6MG WINTERGREEN',
|
|
description: '产品名称',
|
|
type: 'string',
|
|
required: true,
|
|
})
|
|
@Column()
|
|
name: string;
|
|
|
|
@ApiProperty()
|
|
@Column({ default: ''})
|
|
nameCn: string;
|
|
|
|
@ApiProperty({ example: '产品描述', description: '产品描述', type: 'string' })
|
|
@Column({ nullable: true })
|
|
description?: string;
|
|
|
|
@ApiProperty({ example: '1', description: '分类 ID', type: 'number' })
|
|
@Column()
|
|
categoryId: number;
|
|
|
|
@ApiProperty()
|
|
@Column()
|
|
flavorsId: number;
|
|
|
|
@ApiProperty()
|
|
@Column()
|
|
strengthId: number;
|
|
|
|
@ApiProperty()
|
|
@Column()
|
|
humidity: string;
|
|
|
|
@ApiProperty({ description: 'sku', type: 'string' })
|
|
@Column({ nullable: true })
|
|
sku?: string;
|
|
|
|
@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;
|
|
}
|