Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IDLE-190] 센터 관리자 인증 요청 목록 조회 API #232

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}

}

}
Loading