create database structure

This commit is contained in:
Anika Raemer 2025-09-27 17:39:13 +02:00
parent e5b5d7e67d
commit ad6ee64565
15 changed files with 483 additions and 14 deletions

View file

@ -0,0 +1,20 @@
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 })
title!: string;
@Column({ nullable: false })
sortOrder!: number;
@ManyToOne(() => RecipeIngredientGroupEntity, (ingredientGroup) => ingredientGroup.ingredients,
{onDelete: "CASCADE"}
)
ingredientGroup!: Relation<RecipeIngredientGroupEntity>;
}