diff --git a/simtong-domain/src/main/kotlin/team/comit/simtong/domain/auth/model/AuthCode.kt b/simtong-domain/src/main/kotlin/team/comit/simtong/domain/auth/model/AuthCode.kt new file mode 100644 index 00000000..e97f95a9 --- /dev/null +++ b/simtong-domain/src/main/kotlin/team/comit/simtong/domain/auth/model/AuthCode.kt @@ -0,0 +1,26 @@ +package team.comit.simtong.domain.auth.model + +import team.comit.simtong.global.annotation.Aggregate + +/** + * + * AuthCodeAggregate Root를 담당하는 AuthCode + * + * @author Chokyunghyeon + * @date 2022/09/24 + * @version 1.0.0 + **/ +@Aggregate +class AuthCode( + val key: String, + + val code: String, + + val expirationTime: Int +) { + + companion object { + const val EXPIRED = 180 + } + +} \ No newline at end of file diff --git a/simtong-domain/src/main/kotlin/team/comit/simtong/domain/auth/model/AuthCodeLimit.kt b/simtong-domain/src/main/kotlin/team/comit/simtong/domain/auth/model/AuthCodeLimit.kt index dbc46240..6e9f65e1 100644 --- a/simtong-domain/src/main/kotlin/team/comit/simtong/domain/auth/model/AuthCodeLimit.kt +++ b/simtong-domain/src/main/kotlin/team/comit/simtong/domain/auth/model/AuthCodeLimit.kt @@ -4,7 +4,7 @@ import team.comit.simtong.global.annotation.Aggregate /** * - * AuthCodeLimit Aggregate Root를 담당하는 AuthCodeLimit + * AuthCodeLimitAggregate Root를 담당하는 AuthCodeLimit * * @author Chokyunghyeon * @author kimbeomjin @@ -20,4 +20,21 @@ class AuthCodeLimit( val attemptCount: Short, val isVerified: Boolean -) \ No newline at end of file +) { + + companion object { + const val EXPIRED = 1800 + const val MAX_ATTEMPT_COUNT = 5 + const val VERIFIED_EXPIRED = 2700 + } + + fun sendAuthCode(): AuthCodeLimit { + return AuthCodeLimit( + key = key, + expirationTime = expirationTime, + attemptCount = attemptCount.inc(), + isVerified = false + ) + } + +} \ No newline at end of file