Files
dmenu-api/src/modules/foods/entities/category.entity.ts
T
2025-11-15 09:14:32 +03:30

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;
}