From 76faf69ae3ad9ea6d1f8ebe330a5d1b6d8ecf50f Mon Sep 17 00:00:00 2001 From: GeunH Date: Mon, 4 Dec 2023 16:17:14 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20=EC=9D=8C=EC=8B=9D=EC=A0=90=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=9D=91?= =?UTF-8?q?=EB=8B=B5=20reviewList=EC=97=90=20review=EC=82=AC=EC=A7=84=20?= =?UTF-8?q?=EC=9D=91=EB=8B=B5=20=EC=B6=94=EA=B0=80=20#172?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- be/src/restaurant/restaurant.service.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/be/src/restaurant/restaurant.service.ts b/be/src/restaurant/restaurant.service.ts index 962ecbd4..7d3e7008 100644 --- a/be/src/restaurant/restaurant.service.ts +++ b/be/src/restaurant/restaurant.service.ts @@ -8,6 +8,7 @@ import { TokenInfo } from "src/user/user.decorator"; import { UserRepository } from "src/user/user.repository"; import { ReviewRepository } from "src/review/review.repository"; import { LocationDto } from "./dto/location.dto"; +import { AwsService } from "src/aws/aws.service"; const key = process.env.API_KEY; @@ -26,7 +27,8 @@ export class RestaurantService implements OnModuleInit { constructor( private restaurantRepository: RestaurantRepository, private userRepository: UserRepository, - private reviewRepository: ReviewRepository + private reviewRepository: ReviewRepository, + private awsService: AwsService ) { } async searchRestaurant(searchInfoDto: SearchInfoDto, tokenInfo: TokenInfo) { @@ -68,7 +70,8 @@ export class RestaurantService implements OnModuleInit { "review.restroomCleanliness", "review.overallExperience", "user.nickName as reviewer", - "review.createdAt" + "review.createdAt", + "review.reviewImage" ]) .where("review.restaurant_id = :restaurantId", { restaurantId: restaurant.restaurant_id, @@ -76,9 +79,11 @@ export class RestaurantService implements OnModuleInit { .getRawMany(); restaurant.restaurant_reviewCnt = reviews.length; - restaurant.reviews = reviews.slice(0, 3); - - + const reviewList = reviews.slice(0, 3); + reviewList.forEach((element) => { + if (element.review_reviewImage) element.review_reviewImage = this.awsService.getImageURL(element.review_reviewImage); + }) + restaurant.reviews = reviewList; return restaurant; }