From 8bf6a31198668c04b30f7a45aaff99b7129adda7 Mon Sep 17 00:00:00 2001 From: soohyeon Date: Wed, 20 Nov 2024 23:45:45 +0900 Subject: [PATCH 1/3] add :: webp --- src/main/kotlin/org/meogo/global/s3/FileUtil.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/org/meogo/global/s3/FileUtil.kt b/src/main/kotlin/org/meogo/global/s3/FileUtil.kt index 49ee41c..8917fbb 100644 --- a/src/main/kotlin/org/meogo/global/s3/FileUtil.kt +++ b/src/main/kotlin/org/meogo/global/s3/FileUtil.kt @@ -72,7 +72,7 @@ class FileUtil( val originalFilename = file.originalFilename!! val ext = originalFilename.substring(originalFilename.lastIndexOf(".") + 1).lowercase(Locale.getDefault()) - if (!(ext == "jpg" || ext == "jpeg" || ext == "png" || ext == "heic" || ext == "hwp" || ext == "pptx")) { + if (!(ext == "jpg" || ext == "jpeg" || ext == "png" || ext == "heic" || ext == "hwp" || ext == "pptx" || ext == "webp")) { throw Exception() } From 1193e70f97e40dda72c6cec4b845aaa02044928a Mon Sep 17 00:00:00 2001 From: soohyeon Date: Wed, 20 Nov 2024 23:46:35 +0900 Subject: [PATCH 2/3] modify :: pic response --- .../dto/response/ReviewPictureResponse.kt | 2 +- .../review/service/QueryReviewPictureService.kt | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/org/meogo/domain/review/presentation/dto/response/ReviewPictureResponse.kt b/src/main/kotlin/org/meogo/domain/review/presentation/dto/response/ReviewPictureResponse.kt index 40f97a8..9cbcffd 100644 --- a/src/main/kotlin/org/meogo/domain/review/presentation/dto/response/ReviewPictureResponse.kt +++ b/src/main/kotlin/org/meogo/domain/review/presentation/dto/response/ReviewPictureResponse.kt @@ -2,5 +2,5 @@ package org.meogo.domain.review.presentation.dto.response data class ReviewPictureResponse( val year: Int, - val image: String + val image: List ) diff --git a/src/main/kotlin/org/meogo/domain/review/service/QueryReviewPictureService.kt b/src/main/kotlin/org/meogo/domain/review/service/QueryReviewPictureService.kt index d471daa..9be3768 100644 --- a/src/main/kotlin/org/meogo/domain/review/service/QueryReviewPictureService.kt +++ b/src/main/kotlin/org/meogo/domain/review/service/QueryReviewPictureService.kt @@ -16,16 +16,19 @@ class QueryReviewPictureService( @Transactional fun queryReviewPicture(schoolId: Int): List { val reviews = reviewRepository.findAllBySchoolId(schoolId)?.sortedByDescending { it.id } ?: return emptyList() - - val pictures = reviews + println(reviews) + val picturesByYear = reviews .flatMap { review -> val year = review.date.year review.picture?.split(",")?.map { pic -> - val pictureUrl = fileUtil.generateObjectUrl(pic.trim(), Path.REVIEW) - ReviewPictureResponse(year, pictureUrl) + val imgUrl = fileUtil.generateObjectUrl(pic.trim(), Path.REVIEW) + Pair(year, imgUrl) } ?: emptyList() } + .groupBy { it.first } - return pictures + return picturesByYear.map { (year, urls) -> + ReviewPictureResponse(year, urls.map { it.second }) + } } } From 6bfc5fafb415fe41355978c14893f7611fdb1b69 Mon Sep 17 00:00:00 2001 From: soohyeon Date: Thu, 21 Nov 2024 08:47:09 +0900 Subject: [PATCH 3/3] delete :: print --- .../org/meogo/domain/review/service/QueryReviewPictureService.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/kotlin/org/meogo/domain/review/service/QueryReviewPictureService.kt b/src/main/kotlin/org/meogo/domain/review/service/QueryReviewPictureService.kt index 9be3768..1f5cdfc 100644 --- a/src/main/kotlin/org/meogo/domain/review/service/QueryReviewPictureService.kt +++ b/src/main/kotlin/org/meogo/domain/review/service/QueryReviewPictureService.kt @@ -16,7 +16,6 @@ class QueryReviewPictureService( @Transactional fun queryReviewPicture(schoolId: Int): List { val reviews = reviewRepository.findAllBySchoolId(schoolId)?.sortedByDescending { it.id } ?: return emptyList() - println(reviews) val picturesByYear = reviews .flatMap { review -> val year = review.date.year