test #397

Merged
klaus merged 15 commits from test into main 2026-03-05 09:17:38 +00:00
2 changed files with 17 additions and 4 deletions
Showing only changes of commit 70530f87fc - Show all commits

View File

@@ -15,7 +15,7 @@ interface AuthQueryRepository {
fun getMemberIdsByDi(di: String): List<Long>
fun getMemberIdsByNameAndBirthAndDiAndGender(name: String, birth: String, di: String, gender: Int): List<Long>
fun getAuthIdByMemberId(memberId: Long): Long?
fun getActiveMemberIdsByDi(di: String): List<Long>
fun getActiveMemberIdsByNameAndBirthAndDiAndUniqueCi(name: String, birth: String, di: String, uniqueCi: String): List<Long>
}
class AuthQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : AuthQueryRepository {
@@ -60,13 +60,21 @@ class AuthQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : AuthQ
.fetchFirst()
}
override fun getActiveMemberIdsByDi(di: String): List<Long> {
override fun getActiveMemberIdsByNameAndBirthAndDiAndUniqueCi(
name: String,
birth: String,
di: String,
uniqueCi: String
): List<Long> {
return queryFactory
.select(member.id)
.from(member)
.leftJoin(member.auth, auth)
.where(
auth.di.eq(di)
auth.name.eq(name)
.and(auth.birth.eq(birth))
.and(auth.di.eq(di))
.and(auth.uniqueCi.eq(uniqueCi))
.and(member.isActive.isTrue)
)
.fetch()

View File

@@ -81,7 +81,12 @@ class AuthService(
@Transactional
fun authenticate(certificate: AuthVerifyCertificate, memberId: Long): AuthResponse {
val memberIds = repository.getActiveMemberIdsByDi(di = certificate.di)
val memberIds = repository.getActiveMemberIdsByNameAndBirthAndDiAndUniqueCi(
name = certificate.name,
birth = certificate.birth,
di = certificate.di,
uniqueCi = certificate.unique
)
if (memberIds.size >= 3) {
val message = messageSource.getMessage("member.auth.max_accounts", langContext.lang) ?: ""
throw SodaException(