Skip to content

Commit

Permalink
add: (#78) 도메인 인증 모델
Browse files Browse the repository at this point in the history
  • Loading branch information
khcho0125 committed Sep 25, 2022
1 parent 8596c78 commit fb695e5
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import team.comit.simtong.global.annotation.Aggregate

/**
*
* AuthCodeLimit Aggregate Root를 담당하는 AuthCodeLimit
* AuthCodeLimitAggregate Root를 담당하는 AuthCodeLimit
*
* @author Chokyunghyeon
* @author kimbeomjin
Expand All @@ -20,4 +20,21 @@ class AuthCodeLimit(
val attemptCount: Short,

val isVerified: Boolean
)
) {

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
)
}

}

0 comments on commit fb695e5

Please sign in to comment.