From e8146f0bc958e1e77209a63889b6aa7e6900a3e9 Mon Sep 17 00:00:00 2001 From: soohyeon Date: Mon, 7 Oct 2024 15:12:43 +0900 Subject: [PATCH] fix :: match logic error --- .../org/meogo/domain/review/service/QueryMatchService.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/org/meogo/domain/review/service/QueryMatchService.kt b/src/main/kotlin/org/meogo/domain/review/service/QueryMatchService.kt index ca31a4a..d54e863 100644 --- a/src/main/kotlin/org/meogo/domain/review/service/QueryMatchService.kt +++ b/src/main/kotlin/org/meogo/domain/review/service/QueryMatchService.kt @@ -1,5 +1,6 @@ package org.meogo.domain.review.service +import org.meogo.domain.review.domain.ReviewRepository import org.meogo.domain.user.exception.UserNotFoundException import org.meogo.domain.user.facade.UserFacade import org.springframework.stereotype.Service @@ -7,12 +8,14 @@ import org.springframework.transaction.annotation.Transactional @Service class QueryMatchService( - private val userFacade: UserFacade + private val userFacade: UserFacade, + private val reviewRepository: ReviewRepository ) { @Transactional(readOnly = true) fun execute(schoolId: Int): Boolean { val user = userFacade.currentUser() ?: throw UserNotFoundException + if (reviewRepository.existsByUserId(user.id!!)) return false return user.enrolledSchool == schoolId } }