Skip to content

Commit

Permalink
FEAT :: 배포 상세조회 API 개발
Browse files Browse the repository at this point in the history
  • Loading branch information
HyunSu1768 committed Mar 30, 2024
1 parent cff0382 commit e2f93d6
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import xquare.app.xquareinfra.infrastructure.feign.client.dsm.dto.GetDsmUserInfo
@Service
class LoginService(
private val dsmLoginClient: DsmLoginClient,
private val findUserPort: FindUserPort,
private val generateJwtPort: GenerateJwtPort
): LoginUseCase {
override fun login(loginRequest: LoginRequest): TokenResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@ package xquare.app.xquareinfra.domain.deploy.adapter
import org.springframework.web.bind.annotation.*
import xquare.app.xquareinfra.domain.deploy.adapter.dto.request.ApproveDeployRequest
import xquare.app.xquareinfra.domain.deploy.adapter.dto.request.CreateDeployRequest
import xquare.app.xquareinfra.domain.deploy.adapter.dto.response.DeployDetailsResponse
import xquare.app.xquareinfra.domain.deploy.adapter.dto.response.SimpleDeployListResponse
import xquare.app.xquareinfra.domain.deploy.application.port.`in`.ApproveDeployUseCase
import xquare.app.xquareinfra.domain.deploy.application.port.`in`.CreateDeployUseCase
import xquare.app.xquareinfra.domain.deploy.application.port.`in`.FindAllDeployInTeamUseCase
import xquare.app.xquareinfra.domain.deploy.application.port.`in`.GetAllDeployInTeamUseCase
import xquare.app.xquareinfra.domain.deploy.application.port.`in`.GetDeployDetailsUseCase
import java.util.*

@RequestMapping("/deploy")
@RestController
class DeployWebAdapter(
private val createDeployUseCase: CreateDeployUseCase,
private val approveDeployUseCase: ApproveDeployUseCase,
private val findAllDeployInTeamUseCase: FindAllDeployInTeamUseCase
private val getAllDeployInTeamUseCase: GetAllDeployInTeamUseCase,
private val getDeployDetailsUseCase: GetDeployDetailsUseCase
) {
@PostMapping
fun createDeploy(
Expand All @@ -40,5 +43,11 @@ class DeployWebAdapter(
fun findAllInTeam(
@RequestParam("teamId", required = true)
teamId: UUID
): SimpleDeployListResponse = findAllDeployInTeamUseCase.findAllDeployInTime(teamId)
): SimpleDeployListResponse = getAllDeployInTeamUseCase.getAllDeployInTime(teamId)

@GetMapping("/{deployId}")
fun findDeployDetail(
@PathVariable("deployId", required = true)
deployId: UUID
): DeployDetailsResponse = getDeployDetailsUseCase.getDeployDetails(deployId)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package xquare.app.xquareinfra.domain.deploy.adapter.dto.response

import xquare.app.xquareinfra.domain.deploy.domain.DeployStatus

data class DeployDetailsResponse(
val teamNameEn: String,
val teamNameKo: String,
val oneLineDescription: String,
val repository: String,
val projectRootDir: String,
val deployStatus: DeployStatus
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ package xquare.app.xquareinfra.domain.deploy.application.port.`in`
import xquare.app.xquareinfra.domain.deploy.adapter.dto.response.SimpleDeployListResponse
import java.util.*

interface FindAllDeployInTeamUseCase {
fun findAllDeployInTime(teamId: UUID): SimpleDeployListResponse
interface GetAllDeployInTeamUseCase {
fun getAllDeployInTime(teamId: UUID): SimpleDeployListResponse
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package xquare.app.xquareinfra.domain.deploy.application.port.`in`

import xquare.app.xquareinfra.domain.deploy.adapter.dto.response.DeployDetailsResponse
import java.util.UUID

interface GetDeployDetailsUseCase {
fun getDeployDetails(deployId: UUID): DeployDetailsResponse
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package xquare.app.xquareinfra.domain.deploy.application.port.out

import xquare.app.xquareinfra.domain.deploy.domain.Deploy
import xquare.app.xquareinfra.domain.team.domain.Team
import java.util.UUID

interface FindDeployPort {
fun findByDeployName(deployName: String): Deploy?
fun findAllByTeam(team: Team): List<Deploy>
fun findById(deployId: UUID): Deploy?
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package xquare.app.xquareinfra.domain.deploy.application.port.out.persistence

import org.springframework.data.repository.findByIdOrNull
import org.springframework.stereotype.Component
import xquare.app.xquareinfra.domain.deploy.application.port.out.CreateDeployPort
import xquare.app.xquareinfra.domain.deploy.application.port.out.ExistDeployPort
import xquare.app.xquareinfra.domain.deploy.application.port.out.FindDeployPort
import xquare.app.xquareinfra.domain.deploy.application.port.out.persistence.repository.DeployRepository
import xquare.app.xquareinfra.domain.deploy.domain.Deploy
import xquare.app.xquareinfra.domain.team.domain.Team
import java.util.*

@Component
class DeployPersistenceAdapter(
Expand All @@ -16,4 +18,5 @@ class DeployPersistenceAdapter(
override fun existByDeployName(deployName: String): Boolean = deployRepository.existsByDeployName(deployName)
override fun findByDeployName(deployName: String): Deploy? = deployRepository.findByDeployName(deployName)
override fun findAllByTeam(team: Team): List<Deploy> = deployRepository.findAllByTeam(team)
override fun findById(deployId: UUID): Deploy? = deployRepository.findByIdOrNull(deployId)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import xquare.app.xquareinfra.domain.deploy.adapter.dto.response.SimpleDeployListResponse
import xquare.app.xquareinfra.domain.deploy.adapter.dto.response.SimpleDeployResponse
import xquare.app.xquareinfra.domain.deploy.application.port.`in`.FindAllDeployInTeamUseCase
import xquare.app.xquareinfra.domain.deploy.application.port.`in`.GetAllDeployInTeamUseCase
import xquare.app.xquareinfra.domain.deploy.application.port.out.FindDeployPort
import xquare.app.xquareinfra.domain.team.application.port.out.FindTeamPort
import xquare.app.xquareinfra.infrastructure.exception.BusinessLogicException
import java.util.*

@Transactional(readOnly = true)
@Service
class FindAllDeployInTeamService(
class GetAllDeployInTeamService(
private val findTeamPort: FindTeamPort,
private val findDeployPort: FindDeployPort
): FindAllDeployInTeamUseCase {
override fun findAllDeployInTime(teamId: UUID): SimpleDeployListResponse {
): GetAllDeployInTeamUseCase {
override fun getAllDeployInTime(teamId: UUID): SimpleDeployListResponse {
val team = findTeamPort.findById(teamId) ?: throw BusinessLogicException.TEAM_NOT_FOUND
val deployList = findDeployPort.findAllByTeam(team)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package xquare.app.xquareinfra.domain.deploy.application.service

import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import xquare.app.xquareinfra.domain.deploy.adapter.dto.response.DeployDetailsResponse
import xquare.app.xquareinfra.domain.deploy.application.port.`in`.GetDeployDetailsUseCase
import xquare.app.xquareinfra.domain.deploy.application.port.out.FindDeployPort
import xquare.app.xquareinfra.domain.team.application.port.out.FindTeamPort
import xquare.app.xquareinfra.infrastructure.exception.BusinessLogicException
import java.util.*

@Transactional
@Service
class GetDeployDetailsService(
private val findDeployPort: FindDeployPort
): GetDeployDetailsUseCase {
override fun getDeployDetails(deployId: UUID): DeployDetailsResponse {
val deploy = findDeployPort.findById(deployId) ?: throw BusinessLogicException.DEPLOY_NOT_FOUND

return DeployDetailsResponse(
teamNameKo = deploy.team.teamNameKo,
teamNameEn = deploy.team.teamNameEn,
oneLineDescription = deploy.oneLineDescription,
repository = deploy.repository,
projectRootDir = deploy.projectRootDir,
deployStatus = deploy.deployStatus
)
}
}

0 comments on commit e2f93d6

Please sign in to comment.