Files
backend-service/src/pet-feeder/entity/product.entity.ts
T
2025-01-15 17:29:33 +08:00

31 lines
613 B
TypeScript

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[];
}