Skip to content

Commit

Permalink
refactor: (#286) 가독성 증진
Browse files Browse the repository at this point in the history
  • Loading branch information
softpeanut committed Jan 9, 2023
1 parent 9e93bbc commit ad38208
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class CheckAuthCodeUseCase(
) {

fun execute(email: String, code: String) {
val authCode = queryAuthCodePort.queryAuthCodeByEmail(email) ?: throw AuthExceptions.RequiredNewEmailAuthentication()
val authCode = queryAuthCodePort.queryAuthCodeByEmail(email)
?: throw AuthExceptions.RequiredNewEmailAuthentication()

if (!authCode.code.match(code)) {
throw AuthExceptions.DifferentAuthCode()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ import team.comit.simtong.global.annotation.UseCase
* @author Chokyunghyeon
* @author kimbeomjin
* @date 2022/09/18
* @version 1.0.0
* @version 1.2.5
**/
@UseCase
class ReissueTokenUseCase(
private val jwtPort: JwtPort,
private val queryRefreshTokenPort: QueryRefreshTokenPort
) {

fun execute(request: String): TokenResponse {
val token = queryRefreshTokenPort.queryRefreshTokenByToken(request)
fun execute(token: String): TokenResponse {
val refreshToken = queryRefreshTokenPort.queryRefreshTokenByToken(token)
?: throw AuthExceptions.RefreshTokenNotFound()

return jwtPort.receiveToken(
userId = token.userId,
authority = token.authority
userId = refreshToken.userId,
authority = refreshToken.authority
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ class SendAuthCodeUseCase(
val authCodeLimit = queryAuthCodeLimitPort.queryAuthCodeLimitByEmail(email)
?: AuthCodeLimit.issue(email)

commandAuthCodeLimitPort.save(authCodeLimit.increaseCount())
commandAuthCodeLimitPort.save(
authCodeLimit.increaseCount()
)

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

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

0 comments on commit ad38208

Please sign in to comment.