import { Entity, ManyToOne } from '@mikro-orm/core'; import { BaseEntity } from '../../../common/entities/base.entity'; import { Role } from './role.entity'; import { Restaurant } from 'src/modules/restaurants/entities/restaurant.entity'; import { Admin } from './admin.entity'; @Entity({ tableName: 'admin_roles' }) // Add the Unique constraint for the combination of 'phone' and 'restaurant' // @Unique({ properties: ['phone', 'restaurant'] }) export class AdminRole extends BaseEntity { @ManyToOne(() => Admin) admin!: Admin; @ManyToOne(() => Role) role!: Role; @ManyToOne(() => Restaurant, { nullable: true }) restaurant?: Restaurant; }