save recipes

This commit is contained in:
Anika Raemer 2025-09-28 12:24:59 +02:00
parent 3a887d8dbb
commit 380eb4cd21
18 changed files with 412 additions and 87 deletions

View file

@ -1,4 +1,4 @@
import { Column, Entity, ManyToOne, Relation} from "typeorm";
import { Column, Entity, JoinColumn, ManyToOne, Relation} from "typeorm";
import { AbstractEntity } from "./AbstractEntity.js";
import { RecipeIngredientGroupEntity } from "./RecipeIngredientGroupEntity.js";
@ -19,11 +19,12 @@ export class RecipeIngredientEntity extends AbstractEntity {
@Column({nullable: true})
unit?: string;
@Column({ nullable: false })
@Column({ name: "sort_order", nullable: false })
sortOrder!: number;
@JoinColumn({name: "recipe_ingredient_group_id"})
@ManyToOne(() => RecipeIngredientGroupEntity, (ingredientGroup) => ingredientGroup.ingredients,
{onDelete: "CASCADE"}
{onDelete: "CASCADE", nullable: false}
)
ingredientGroup!: Relation<RecipeIngredientGroupEntity>;
}