Merge pull request '19세 미만이 인증처리 되던 버그 수정' (#112) from test into main

Reviewed-on: #112
This commit is contained in:
klaus 2024-01-08 10:07:21 +00:00
commit 2d17eac199
1 changed files with 16 additions and 9 deletions

View File

@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Value
import org.springframework.data.repository.findByIdOrNull import org.springframework.data.repository.findByIdOrNull
import org.springframework.stereotype.Service import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional import org.springframework.transaction.annotation.Transactional
import java.time.LocalDate
@Service @Service
class AuthService( class AuthService(
@ -82,15 +83,21 @@ class AuthService(
} }
val member = memberRepository.findByIdOrNull(memberId) ?: throw SodaException("로그인 정보를 확인해주세요.") val member = memberRepository.findByIdOrNull(memberId) ?: throw SodaException("로그인 정보를 확인해주세요.")
val auth = Auth( val nowYear = LocalDate.now().year
name = certificate.name, val certificateYear = certificate.birth.substring(0, 4).toInt()
birth = certificate.birth, if (nowYear - certificateYear >= 19) {
uniqueCi = certificate.unique, val auth = Auth(
di = certificate.di, name = certificate.name,
gender = certificate.gender birth = certificate.birth,
) uniqueCi = certificate.unique,
auth.member = member di = certificate.di,
gender = certificate.gender
)
auth.member = member
repository.save(auth) repository.save(auth)
} else {
throw SodaException("19세 미만 인증 오류")
}
} }
} }