Skip to content

Commit

Permalink
fix :: match logic error
Browse files Browse the repository at this point in the history
  • Loading branch information
meltapplee committed Oct 7, 2024
1 parent 21ddc3c commit e8146f0
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
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
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
}
}

0 comments on commit e8146f0

Please sign in to comment.