31 lines
613 B
TypeScript
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[];
|
|
}
|