From 8dac4541862bd9fa16e8fe62ac380028e69652b7 Mon Sep 17 00:00:00 2001 From: wonjunYou Date: Thu, 7 Nov 2024 15:05:06 +0900 Subject: [PATCH] =?UTF-8?q?[IDLE-190]=20=EC=84=BC=ED=84=B0=20=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=EC=9E=90=20=EC=9D=B8=EC=A6=9D=20=EC=9A=94=EC=B2=AD=20?= =?UTF-8?q?=EB=AA=A9=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/domain/CenterManagerService.kt | 4 ++ .../service/facade/CenterAuthFacadeService.kt | 11 ++++ .../jpa/CenterManagerJpaRepository.kt | 12 ++++ .../auth/center/api/CenterAuthApi.kt | 8 +++ .../center/controller/CenterAuthController.kt | 5 ++ .../center/CenterManagerForPendingResponse.kt | 56 +++++++++++++++++++ 6 files changed, 96 insertions(+) create mode 100644 idle-support/transfer/src/main/kotlin/com/swm/idle/support/transfer/auth/center/CenterManagerForPendingResponse.kt diff --git a/idle-application/src/main/kotlin/com/swm/idle/application/user/center/service/domain/CenterManagerService.kt b/idle-application/src/main/kotlin/com/swm/idle/application/user/center/service/domain/CenterManagerService.kt index 6fd56c9f..47681d49 100644 --- a/idle-application/src/main/kotlin/com/swm/idle/application/user/center/service/domain/CenterManagerService.kt +++ b/idle-application/src/main/kotlin/com/swm/idle/application/user/center/service/domain/CenterManagerService.kt @@ -91,4 +91,8 @@ class CenterManagerService( ) } + fun findAllByStatusPending(): List? { + return centerManagerJpaRepository.findAllByStatusPending() + } + } diff --git a/idle-application/src/main/kotlin/com/swm/idle/application/user/center/service/facade/CenterAuthFacadeService.kt b/idle-application/src/main/kotlin/com/swm/idle/application/user/center/service/facade/CenterAuthFacadeService.kt index f4467be9..a2e6ea1e 100644 --- a/idle-application/src/main/kotlin/com/swm/idle/application/user/center/service/facade/CenterAuthFacadeService.kt +++ b/idle-application/src/main/kotlin/com/swm/idle/application/user/center/service/facade/CenterAuthFacadeService.kt @@ -19,6 +19,7 @@ import com.swm.idle.infrastructure.client.businessregistration.exception.Busines import com.swm.idle.infrastructure.client.businessregistration.service.BusinessRegistrationNumberValidationService import com.swm.idle.support.common.encrypt.PasswordEncryptor import com.swm.idle.support.security.exception.SecurityException +import com.swm.idle.support.transfer.auth.center.CenterManagerForPendingResponse import com.swm.idle.support.transfer.auth.center.ValidateBusinessRegistrationNumberResponse import com.swm.idle.support.transfer.auth.common.LoginResponse import com.swm.idle.support.transfer.user.center.JoinStatusInfoResponse @@ -151,4 +152,14 @@ class CenterAuthFacadeService( } } + fun getCenterManagerForPending(): CenterManagerForPendingResponse { + val centerManagers = centerManagerService.findAllByStatusPending() + + return centerManagers?.map { centerManager -> + CenterManagerForPendingResponse.PendingCenterManagerDto.of(centerManager) + }?.let { + CenterManagerForPendingResponse.of(it) + } ?: CenterManagerForPendingResponse.of(emptyList()) + } + } diff --git a/idle-domain/src/main/kotlin/com/swm/idle/domain/user/center/repository/jpa/CenterManagerJpaRepository.kt b/idle-domain/src/main/kotlin/com/swm/idle/domain/user/center/repository/jpa/CenterManagerJpaRepository.kt index 76fc4261..db066d23 100644 --- a/idle-domain/src/main/kotlin/com/swm/idle/domain/user/center/repository/jpa/CenterManagerJpaRepository.kt +++ b/idle-domain/src/main/kotlin/com/swm/idle/domain/user/center/repository/jpa/CenterManagerJpaRepository.kt @@ -2,6 +2,7 @@ package com.swm.idle.domain.user.center.repository.jpa import com.swm.idle.domain.user.center.entity.jpa.CenterManager import org.springframework.data.jpa.repository.JpaRepository +import org.springframework.data.jpa.repository.Query import org.springframework.stereotype.Repository import java.util.* @@ -16,4 +17,15 @@ interface CenterManagerJpaRepository : JpaRepository { fun findAllByCenterBusinessRegistrationNumber(centerBusinessRegistrationNumber: String): List? + @Query( + value = + """ + SELECT * + FROM center_manager + WHERE center_manager.status = 'PENDING' + """, + nativeQuery = true + ) + fun findAllByStatusPending(): List? + } diff --git a/idle-presentation/src/main/kotlin/com/swm/idle/presentation/auth/center/api/CenterAuthApi.kt b/idle-presentation/src/main/kotlin/com/swm/idle/presentation/auth/center/api/CenterAuthApi.kt index cc483d83..658dcdf4 100644 --- a/idle-presentation/src/main/kotlin/com/swm/idle/presentation/auth/center/api/CenterAuthApi.kt +++ b/idle-presentation/src/main/kotlin/com/swm/idle/presentation/auth/center/api/CenterAuthApi.kt @@ -3,12 +3,14 @@ package com.swm.idle.presentation.auth.center.api import com.swm.idle.presentation.common.exception.ErrorResponse import com.swm.idle.presentation.common.security.annotation.Secured import com.swm.idle.support.transfer.auth.center.CenterLoginRequest +import com.swm.idle.support.transfer.auth.center.CenterManagerForPendingResponse import com.swm.idle.support.transfer.auth.center.ChangePasswordRequest import com.swm.idle.support.transfer.auth.center.JoinRequest import com.swm.idle.support.transfer.auth.center.ValidateBusinessRegistrationNumberResponse import com.swm.idle.support.transfer.auth.center.WithdrawRequest import com.swm.idle.support.transfer.auth.common.LoginResponse import com.swm.idle.support.transfer.user.center.JoinStatusInfoResponse +import io.swagger.v3.oas.annotations.Hidden import io.swagger.v3.oas.annotations.Operation import io.swagger.v3.oas.annotations.media.Content import io.swagger.v3.oas.annotations.media.Schema @@ -47,6 +49,12 @@ interface CenterAuthApi { @ResponseStatus(HttpStatus.NO_CONTENT) fun requestCenterManagerVerification() + @Hidden + @Operation(summary = "센터 관리자 인증 대기 목록 조회 API") + @GetMapping("/join/requests") + @ResponseStatus(HttpStatus.OK) + fun getCenterManagerForPending(): CenterManagerForPendingResponse + @Operation(summary = "사업자 등록번호 인증 API") @GetMapping("/authentication/{business-registration-number}") @ResponseStatus(HttpStatus.OK) diff --git a/idle-presentation/src/main/kotlin/com/swm/idle/presentation/auth/center/controller/CenterAuthController.kt b/idle-presentation/src/main/kotlin/com/swm/idle/presentation/auth/center/controller/CenterAuthController.kt index 9b59cb1d..00d7c40e 100644 --- a/idle-presentation/src/main/kotlin/com/swm/idle/presentation/auth/center/controller/CenterAuthController.kt +++ b/idle-presentation/src/main/kotlin/com/swm/idle/presentation/auth/center/controller/CenterAuthController.kt @@ -7,6 +7,7 @@ import com.swm.idle.domain.user.center.vo.Password import com.swm.idle.domain.user.common.vo.PhoneNumber import com.swm.idle.presentation.auth.center.api.CenterAuthApi import com.swm.idle.support.transfer.auth.center.CenterLoginRequest +import com.swm.idle.support.transfer.auth.center.CenterManagerForPendingResponse import com.swm.idle.support.transfer.auth.center.ChangePasswordRequest import com.swm.idle.support.transfer.auth.center.JoinRequest import com.swm.idle.support.transfer.auth.center.ValidateBusinessRegistrationNumberResponse @@ -38,6 +39,10 @@ class CenterAuthController( return centerAuthFacadeService.requestCenterManagerVerification() } + override fun getCenterManagerForPending(): CenterManagerForPendingResponse { + return centerAuthFacadeService.getCenterManagerForPending() + } + override fun validateBusinessRegistrationNumber(businessRegistrationNumber: String): ValidateBusinessRegistrationNumberResponse { return centerAuthFacadeService.validateCompany( businessRegistrationNumber = BusinessRegistrationNumber(businessRegistrationNumber), diff --git a/idle-support/transfer/src/main/kotlin/com/swm/idle/support/transfer/auth/center/CenterManagerForPendingResponse.kt b/idle-support/transfer/src/main/kotlin/com/swm/idle/support/transfer/auth/center/CenterManagerForPendingResponse.kt new file mode 100644 index 00000000..5e126549 --- /dev/null +++ b/idle-support/transfer/src/main/kotlin/com/swm/idle/support/transfer/auth/center/CenterManagerForPendingResponse.kt @@ -0,0 +1,56 @@ +package com.swm.idle.support.transfer.auth.center + +import com.swm.idle.domain.user.center.entity.jpa.CenterManager +import io.swagger.v3.oas.annotations.media.Schema +import java.util.* + +@Schema( + name = "CenterManagerForPendingResponse", + description = "센터 관리자 인증 대기 목록 조회 응답" +) +data class CenterManagerForPendingResponse( + val pendingCenterManagers: List?, +) { + + data class PendingCenterManagerDto( + @Schema(description = "센터 관리자 ID") + val id: UUID, + + @Schema(description = "센터 관리자 로그인 ID") + val identifier: String, + + @Schema(description = "센터 관리자 성명") + val managerName: String, + + @Schema(description = "센터 사업자 등록 번호") + val centerBusinessRegistrationNumber: String, + + @Schema(description = "센터 관리자 개인 연락처") + val phoneNumber: String, + ) { + + companion object { + + fun of(centerManager: CenterManager): PendingCenterManagerDto { + return PendingCenterManagerDto( + id = centerManager.id, + identifier = centerManager.identifier, + managerName = centerManager.name, + centerBusinessRegistrationNumber = centerManager.centerBusinessRegistrationNumber, + phoneNumber = centerManager.phoneNumber + ) + } + + } + + } + + companion object { + + fun of(pendingCenterManagerDtos: List?): CenterManagerForPendingResponse { + return CenterManagerForPendingResponse(pendingCenterManagerDtos) + } + + } + +}