up
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user