22 lines
553 B
TypeScript
22 lines
553 B
TypeScript
import { Entity, Property, ManyToMany, Collection } from '@mikro-orm/core';
|
|
import { Food } from './food.entity';
|
|
import { BaseEntity } from '../../../common/entities/base.entity';
|
|
|
|
@Entity({ tableName: 'categories' })
|
|
export class Category extends BaseEntity {
|
|
@Property()
|
|
title!: string;
|
|
|
|
@ManyToMany(() => Food, food => food.categories)
|
|
foods = new Collection<Food>(this);
|
|
|
|
@Property({ default: true })
|
|
isActive: boolean = true;
|
|
|
|
@Property({ nullable: true })
|
|
restId?: string;
|
|
|
|
@Property({ nullable: true })
|
|
avatarUrl?: string;
|
|
}
|