category
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Entity, Property, ManyToMany, Collection } from '@mikro-orm/core';
|
||||
import { Entity, Property, Collection, OneToMany } from '@mikro-orm/core';
|
||||
import { Food } from './food.entity';
|
||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||
|
||||
@@ -7,7 +7,7 @@ export class Category extends BaseEntity {
|
||||
@Property()
|
||||
title!: string;
|
||||
|
||||
@ManyToMany(() => Food, food => food.categories)
|
||||
@OneToMany(() => Food, food => food.category)
|
||||
foods = new Collection<Food>(this);
|
||||
|
||||
@Property({ default: true })
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Collection, Entity, ManyToMany, ManyToOne, Property } from '@mikro-orm/core';
|
||||
import { Entity, ManyToOne, Property } from '@mikro-orm/core';
|
||||
import { Category } from './category.entity';
|
||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||
import { Restaurant } from '../../../modules/restaurants/entities/restaurant.entity';
|
||||
@@ -8,8 +8,8 @@ export class Food extends BaseEntity {
|
||||
@ManyToOne(() => Restaurant)
|
||||
restaurant: Restaurant;
|
||||
|
||||
@ManyToMany(() => Category)
|
||||
categories = new Collection<Category>(this);
|
||||
@ManyToOne(() => Category)
|
||||
category!: Category;
|
||||
|
||||
@Property({ nullable: true })
|
||||
title?: string;
|
||||
|
||||
Reference in New Issue
Block a user