import { Entity, ManyToOne, Unique } from '@mikro-orm/core';
import { BaseEntity } from '../../../common/entities/base.entity';
import { User } from '../../users/entities/user.entity';
import { Food } from '../../foods/entities/food.entity';

@Entity({ tableName: 'favorites' })
@Unique({ properties: ['user', 'food'] })
export class Favorite extends BaseEntity {
    @ManyToOne(() => User)
    user: User;

    @ManyToOne(() => Food)
    food: Food;
}
