feat: 创建产品接口

This commit is contained in:
ilhamtahir committed 2025-01-15 17:29:33 +08:00
1 parent 7c34f8b986
commit 8d72401f74
13 files changed
+217 -11

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
import { BaseEntity } from '@/core/entity/base.entity';
import { Column, Entity, OneToMany } from 'typeorm';
import { FeedingPlanProduct } from '@/pet-feeder/entity/feeding-plan-product.entity';
@Entity()
export class Product extends BaseEntity {
@Column()
name: string;
@Column()
photo: string;
@Column({
type: 'json',
})
tags: string[];
@Column()
totalCalories: number;
@Column()
totalWeight: number;
@OneToMany(
() => FeedingPlanProduct,
(feedingPlanProduct) => feedingPlanProduct.feedingPlan,
{ cascade: true },
)
feedingPlanProducts: FeedingPlanProduct[];
}