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