diff --git a/be/src/user/user.restaurantList.repository.ts b/be/src/user/user.restaurantList.repository.ts index 1c5ade7..b5dbc78 100644 --- a/be/src/user/user.restaurantList.repository.ts +++ b/be/src/user/user.restaurantList.repository.ts @@ -156,33 +156,12 @@ export class UserRestaurantListRepository extends Repository a.count > b.count ? a : b).category; - - const subQuery = await this.createQueryBuilder() - .select("DISTINCT(userRestaurantListSub.restaurantId)", "restaurantId") - .from(UserRestaurantListEntity, "userRestaurantListSub") - .where("userRestaurantListSub.userId = :id", { id }) - .getRawMany(); - - const restaurantIds = subQuery.map(item => item.restaurantId); - + const result = await this .createQueryBuilder("userRestaurantList") .leftJoinAndSelect("userRestaurantList.restaurant", "restaurant") .select(["restaurant.id", "restaurant.name", "restaurant.category"]) - .where("restaurant.category = :category", { category: favoriteCategory }) .andWhere("restaurant.address LIKE :region", { region: `%${region.region}%` }) - .andWhere("userRestaurantList.restaurantId NOT IN (:...restaurantIds)", { restaurantIds: restaurantIds }) .groupBy("restaurant.id") .getRawMany(); @@ -201,32 +180,7 @@ export class UserRestaurantListRepository extends Repository 0) { - let recommendedRestaurants = []; - let usedIndexes = new Set(); - - for (let i = 0; i < Math.min(3, result.length); i++) { - let randomIndex; - do { - randomIndex = Math.floor(Math.random() * result.length); - } while (usedIndexes.has(randomIndex)); - - usedIndexes.add(randomIndex); - recommendedRestaurants.push(result[randomIndex]); - } - return recommendedRestaurants; - } - } + return []; } }