This commit is contained in:
2025-11-15 09:14:32 +03:30
parent 53ef6220c1
commit 84163f6c8c
7 changed files with 25 additions and 22 deletions
@@ -1,14 +1,14 @@
import { Entity, Property, ManyToMany, Collection } from '@mikro-orm/core';
import { Foods } from './food.entity';
import { Food } from './food.entity';
import { BaseEntity } from '../../../common/entities/base.entity';
@Entity({ tableName: 'categories' })
export class Category extends BaseEntity {
@Property({ nullable: true })
title?: string;
@Property()
title!: string;
@ManyToMany(() => Foods, food => food.categories)
foods = new Collection<Foods>(this);
@ManyToMany(() => Food, food => food.categories)
foods = new Collection<Food>(this);
@Property({ default: true })
isActive: boolean = true;
+1 -1
View File
@@ -3,7 +3,7 @@ import { Category } from './category.entity';
import { BaseEntity } from '../../../common/entities/base.entity';
@Entity({ tableName: 'foods' })
export class Foods extends BaseEntity {
export class Food extends BaseEntity {
@ManyToMany(() => Category)
categories = new Collection<Category>(this);