Skip to content

Commit

Permalink
refactor: (#286) AuthCodeLimit Aggregate 변경사항 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
softpeanut committed Jan 9, 2023
1 parent 86047c0 commit 9e93bbc
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package team.comit.simtong.domain.auth.usecase

import team.comit.simtong.domain.auth.exception.AuthExceptions
import team.comit.simtong.domain.auth.model.AuthCode
import team.comit.simtong.domain.auth.model.AuthCodeLimit
import team.comit.simtong.domain.auth.spi.CommandAuthCodeLimitPort
Expand All @@ -15,7 +14,7 @@ import team.comit.simtong.global.annotation.UseCase
*
* @author Chokyunghyeon
* @date 2022/09/24
* @version 1.0.0
* @version 1.2.5
**/
@UseCase
class SendAuthCodeUseCase(
Expand All @@ -27,11 +26,7 @@ class SendAuthCodeUseCase(

fun execute(email: String) {
val authCodeLimit = queryAuthCodeLimitPort.queryAuthCodeLimitByEmail(email)
?: AuthCodeLimit(email)

if (authCodeLimit.verified) {
throw AuthExceptions.AlreadyCertifiedEmail()
}
?: AuthCodeLimit.issue(email)

commandAuthCodeLimitPort.save(authCodeLimit.increaseCount())

Expand Down

0 comments on commit 9e93bbc

Please sign in to comment.