Skip to content

Commit

Permalink
[IDLE-190] 센터 관리자 인증 요청 목록 조회 API
Browse files Browse the repository at this point in the history
  • Loading branch information
wonjunYou committed Nov 7, 2024
1 parent cf124db commit 2fc0228
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,8 @@ class CenterManagerService(
)
}

fun findAllByStatusPending(): List<CenterManager>? {
return centerManagerJpaRepository.findAllByStatusPending()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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.*

Expand All @@ -16,4 +17,15 @@ interface CenterManagerJpaRepository : JpaRepository<CenterManager, UUID> {

fun findAllByCenterBusinessRegistrationNumber(centerBusinessRegistrationNumber: String): List<CenterManager>?

@Query(
value =
"""
SELECT *
FROM center_manager
WHERE center_manager.status = 'PENDING'
""",
nativeQuery = true
)
fun findAllByStatusPending(): List<CenterManager>?

}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
@@ -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<PendingCenterManagerDto>?,
) {

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<PendingCenterManagerDto>?): CenterManagerForPendingResponse {
return CenterManagerForPendingResponse(pendingCenterManagerDtos)
}

}

}

0 comments on commit 2fc0228

Please sign in to comment.