diff --git a/src/modules/foods/controllers/food.controller.ts b/src/modules/foods/controllers/food.controller.ts index 860e5ae..2cd3662 100644 --- a/src/modules/foods/controllers/food.controller.ts +++ b/src/modules/foods/controllers/food.controller.ts @@ -62,8 +62,8 @@ export class FoodController { @ApiHeader(API_HEADER_SLUG) @ApiBearerAuth() @ApiOperation({ summary: 'get my favorites' }) - getMyFavorites(@UserId() userId: string) { - return this.foodsService.getMyFavorites(userId); + getMyFavorites(@UserId() userId: string, @RestId() restId: string) { + return this.foodsService.getMyFavorites(userId, restId); } /* ---------------------------------- Admin ---------------------------------- */ diff --git a/src/modules/foods/providers/food.service.ts b/src/modules/foods/providers/food.service.ts index 3a88b4f..9d5d328 100644 --- a/src/modules/foods/providers/food.service.ts +++ b/src/modules/foods/providers/food.service.ts @@ -260,8 +260,8 @@ export class FoodService { } - async getMyFavorites(userId: string) { - return this.em.find(Favorite, { user: userId }, { populate: ['food'] }); + async getMyFavorites(userId: string,restId: string) { + return this.em.find(Favorite, { user: userId, food: { restaurant: { id: restId } } }, { populate: ['food'] }); } /** * Invalidate cache for restaurant foods