import { Column, Entity, ManyToOne, Relation} from "typeorm"; import { AbstractEntity } from "./AbstractEntity.js"; import { RecipeIngredientGroupEntity } from "./RecipeIngredientGroupEntity.js"; /** * Entity describing an ingredient group for a recipe */ @Entity({ name: "recipe_ingredient" }) export class RecipeIngredientEntity extends AbstractEntity { @Column({ nullable: false }) name!: string; @Column({nullable: true}) subtext?: string; @Column({nullable: true}) amount?: number; @Column({nullable: true}) unit?: string; @Column({ nullable: false }) sortOrder!: number; @ManyToOne(() => RecipeIngredientGroupEntity, (ingredientGroup) => ingredientGroup.ingredients, {onDelete: "CASCADE"} ) ingredientGroup!: Relation; }