-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b379d1a
commit 96e30ee
Showing
3 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/main/kotlin/org/meogo/domain/review/presentation/dto/response/ReviewPictureResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package org.meogo.domain.review.presentation.dto.response | ||
|
||
data class ReviewPictureResponse( | ||
val image: String | ||
) |
22 changes: 22 additions & 0 deletions
22
src/main/kotlin/org/meogo/domain/review/service/QueryReviewPictureService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.meogo.domain.review.service | ||
|
||
import org.meogo.domain.review.presentation.dto.response.ReviewPictureResponse | ||
import org.meogo.domain.review.repository.ReviewRepository | ||
import org.springframework.stereotype.Service | ||
import org.springframework.transaction.annotation.Transactional | ||
|
||
@Service | ||
class QueryReviewPictureService( | ||
private val reviewRepository: ReviewRepository | ||
) { | ||
|
||
@Transactional | ||
fun queryReviewPicture(schoolId: Int): List<ReviewPictureResponse> { | ||
val reviews = reviewRepository.findAllBySchoolId(schoolId) ?: return emptyList() | ||
|
||
val pictures = reviews | ||
.mapNotNull { it.picture?.let { pic -> ReviewPictureResponse(pic) } } | ||
|
||
return pictures | ||
} | ||
} |