create database structure
This commit is contained in:
parent
e5b5d7e67d
commit
ad6ee64565
15 changed files with 483 additions and 14 deletions
20
src/entities/RecipeIngredientEntity.ts
Normal file
20
src/entities/RecipeIngredientEntity.ts
Normal 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>;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue