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 a9ec7bb commit 6d9fff6
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ 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.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 java.util.*

@RequestMapping("/deploy")
@RestController
class DeployWebAdapter(
private val createDeployUseCase: CreateDeployUseCase,
private val approveDeployUseCase: ApproveDeployUseCase
private val approveDeployUseCase: ApproveDeployUseCase,
private val findAllDeployInTeamUseCase: FindAllDeployInTeamUseCase
) {
@PostMapping
fun createDeploy(
Expand All @@ -32,4 +35,10 @@ class DeployWebAdapter(
) {
approveDeployUseCase.approveDeploy(deployNameEn, approveDeployRequest)
}

@GetMapping("/all")
fun findAllInTeam(
@RequestParam("teamId", required = true)
teamId: UUID
): SimpleDeployListResponse = findAllDeployInTeamUseCase.findAllDeployInTime(teamId)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package xquare.app.xquareinfra.domain.deploy.adapter.dto.response

data class SimpleDeployListResponse(
val deployList: List<SimpleDeployResponse>
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package xquare.app.xquareinfra.domain.deploy.adapter.dto.response

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

data class SimpleDeployResponse(
val deployName: String,
val repository: String,
val deployStatus: DeployStatus
)
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.SimpleDeployListResponse
import java.util.*

interface FindAllDeployInTeamUseCase {
fun findAllDeployInTime(teamId: UUID): SimpleDeployListResponse
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
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

interface FindDeployPort {
fun findByDeployName(deployName: String): Deploy?
fun findAllByTeam(team: Team): List<Deploy>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
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.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.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(
private val findTeamPort: FindTeamPort,
private val findDeployPort: FindDeployPort
): FindAllDeployInTeamUseCase {
override fun findAllDeployInTime(teamId: UUID): SimpleDeployListResponse {
val team = findTeamPort.findById(teamId) ?: throw BusinessLogicException.TEAM_NOT_FOUND
val deployList = findDeployPort.findAllByTeam(team)

return SimpleDeployListResponse(
deployList.map {
SimpleDeployResponse(
deployName = it.deployName,
repository = it.repository,
deployStatus = it.deployStatus
)
}
)
}
}

0 comments on commit 6d9fff6

Please sign in to comment.