Skip to content

Commit

Permalink
refactor: (#286) AuthCode Aggregate 변경사항 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
softpeanut committed Jan 9, 2023
1 parent c370696 commit 512ac92
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ class CheckAuthCodeUseCase(
fun execute(email: String, code: String) {
val authCode = queryAuthCodePort.queryAuthCodeByEmail(email) ?: throw AuthExceptions.RequiredNewEmailAuthentication()

if (authCode.code != code) {
if (!authCode.code.match(code)) {
throw AuthExceptions.DifferentAuthCode()
}

commandAuthCodeLimitPort.save(
AuthCodeLimit.certified(email)
)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ class SendAuthCodeUseCase(

commandAuthCodeLimitPort.save(authCodeLimit.increaseCount())

val authCode = commandAuthCodePort.save(AuthCode(email))
val authCode = commandAuthCodePort.save(AuthCode.issue(email))

sendEmailPort.sendAuthCode(authCode.code, email)
sendEmailPort.sendAuthCode(authCode.code.value, email)
}

}

0 comments on commit 512ac92

Please sign in to comment.