fix bug in favorite list
This commit is contained in:
@@ -62,8 +62,8 @@ export class FoodController {
|
|||||||
@ApiHeader(API_HEADER_SLUG)
|
@ApiHeader(API_HEADER_SLUG)
|
||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
@ApiOperation({ summary: 'get my favorites' })
|
@ApiOperation({ summary: 'get my favorites' })
|
||||||
getMyFavorites(@UserId() userId: string) {
|
getMyFavorites(@UserId() userId: string, @RestId() restId: string) {
|
||||||
return this.foodsService.getMyFavorites(userId);
|
return this.foodsService.getMyFavorites(userId, restId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------- Admin ---------------------------------- */
|
/* ---------------------------------- Admin ---------------------------------- */
|
||||||
|
|||||||
@@ -260,8 +260,8 @@ export class FoodService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async getMyFavorites(userId: string) {
|
async getMyFavorites(userId: string,restId: string) {
|
||||||
return this.em.find(Favorite, { user: userId }, { populate: ['food'] });
|
return this.em.find(Favorite, { user: userId, food: { restaurant: { id: restId } } }, { populate: ['food'] });
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Invalidate cache for restaurant foods
|
* Invalidate cache for restaurant foods
|
||||||
|
|||||||
Reference in New Issue
Block a user