From b3fefa6e9a638c505df3f9ea3a238f45f555ac6e Mon Sep 17 00:00:00 2001 From: wjdtkdgns Date: Wed, 5 Jun 2024 23:08:15 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20user=20=EC=83=81=ED=83=9C=20=EB=B3=84?= =?UTF-8?q?=20=EC=A0=91=EA=B7=BC=20=EC=A0=9C=ED=95=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../balancemania/api/auth/application/AuthFacade.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/kotlin/com/balancemania/api/auth/application/AuthFacade.kt b/src/main/kotlin/com/balancemania/api/auth/application/AuthFacade.kt index bf52f7a..ed9168a 100644 --- a/src/main/kotlin/com/balancemania/api/auth/application/AuthFacade.kt +++ b/src/main/kotlin/com/balancemania/api/auth/application/AuthFacade.kt @@ -9,10 +9,12 @@ import com.balancemania.api.auth.model.TokenDto import com.balancemania.api.auth.model.response.TokenRefreshRequest import com.balancemania.api.config.database.TransactionTemplates import com.balancemania.api.exception.ErrorCode +import com.balancemania.api.exception.InvalidRequestException import com.balancemania.api.exception.InvalidTokenException import com.balancemania.api.exception.NoAuthorityException import com.balancemania.api.extension.coExecuteOrNull import com.balancemania.api.user.application.UserService +import com.balancemania.api.user.domain.vo.UserStatusType import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll import kotlinx.coroutines.coroutineScope @@ -38,6 +40,16 @@ class AuthFacade( val user = userService.findByIdOrThrowSync(payload.id) + when (user.statusType) { + UserStatusType.ACTIVE -> { + /** 별도 처리 없음 */ + } + + UserStatusType.DELETED -> throw InvalidRequestException(ErrorCode.WITHDRAW_USER_ERROR) + UserStatusType.BANISHED -> throw InvalidRequestException(ErrorCode.BANISHED_USER_ERROR) + UserStatusType.RESTRICTED_7_DAYS -> throw InvalidRequestException(ErrorCode.RESTRICTED_7_DAYS_USER_ERROR) + } + AuthUserImpl(uid = user.id) } } @@ -78,6 +90,7 @@ class AuthFacade( txTemplates.writer.coExecuteOrNull { user.apply { this.oauthInfo = oauthInfo.withdrawOAuthInfo() + this.statusType = UserStatusType.DELETED }.run { userService.saveSync(this) } } }