Skip to content

Commit

Permalink
fix :: deployName to deployId
Browse files Browse the repository at this point in the history
  • Loading branch information
HyunSu1768 committed Jul 30, 2024
1 parent c8acadc commit 94f8012
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,24 @@ class V1ContainerWebAdapter(

@GetMapping("/environment-variable")
fun getEnvironmentVariable(
@RequestParam("deploy_name", required = true)
deployName: String,
@RequestParam("deployId", required = true)
deployId: UUID,
@RequestParam("environment", required = true)
environment: ContainerEnvironment
): Map<String, String> {
return getEnvironmentVariableUseCase.getEnvironmentVariable(deployName, environment)
return getEnvironmentVariableUseCase.getEnvironmentVariable(deployId, environment)
}

@PatchMapping("/environment-variable")
fun updateEnvironmentVariable(
@RequestParam("deploy_name", required = true)
deployName: String,
@RequestParam("deployId", required = true)
deployId: UUID,
@RequestParam("environment", required = true)
environment: ContainerEnvironment,
@RequestBody
environmentVariable: Map<String, String>
) {
updateEnvironmentVariableUseCase.updateEnvironmentVariable(deployName, environment, environmentVariable)
updateEnvironmentVariableUseCase.updateEnvironmentVariable(deployId, environment, environmentVariable)
}

@GetMapping
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package xquare.app.xquareinfra.domain.container.application.port.`in`

import xquare.app.xquareinfra.domain.container.domain.ContainerEnvironment
import java.util.UUID

interface GetEnvironmentVariableUseCase {
fun getEnvironmentVariable(deployName: String, environment: ContainerEnvironment): Map<String, String>
fun getEnvironmentVariable(deployId: UUID, environment: ContainerEnvironment): Map<String, String>
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package xquare.app.xquareinfra.domain.container.application.port.`in`

import xquare.app.xquareinfra.domain.container.domain.ContainerEnvironment
import java.util.UUID

interface UpdateEnvironmentVariableUseCase {
fun updateEnvironmentVariable(deployName: String, environment: ContainerEnvironment, environmentVariable: Map<String, String>)
fun updateEnvironmentVariable(deployId: UUID, environment: ContainerEnvironment, environmentVariable: Map<String, String>)
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import xquare.app.xquareinfra.domain.deploy.application.port.out.FindDeployPort
import xquare.app.xquareinfra.domain.team.application.port.out.ExistsUserTeamPort
import xquare.app.xquareinfra.infrastructure.exception.BusinessLogicException
import xquare.app.xquareinfra.infrastructure.exception.XquareException
import java.util.UUID

@Service
class GetEnvironmentVariableService(
Expand All @@ -17,8 +18,8 @@ class GetEnvironmentVariableService(
private val existsUserTeamPort: ExistsUserTeamPort,
private val readCurrentUserPort: ReadCurrentUserPort
): GetEnvironmentVariableUseCase {
override fun getEnvironmentVariable(deployName: String, environment: ContainerEnvironment): Map<String, String> {
val deploy = findDeployPort.findByDeployName(deployName) ?: throw BusinessLogicException.DEPLOY_NOT_FOUND
override fun getEnvironmentVariable(deployId: UUID, environment: ContainerEnvironment): Map<String, String> {
val deploy = findDeployPort.findById(deployId) ?: throw BusinessLogicException.DEPLOY_NOT_FOUND

val user = readCurrentUserPort.readCurrentUser()
if(!existsUserTeamPort.existsByTeamAndUser(deploy.team, user)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import xquare.app.xquareinfra.infrastructure.exception.BusinessLogicException
import xquare.app.xquareinfra.infrastructure.exception.XquareException
import xquare.app.xquareinfra.infrastructure.kubernetes.KubernetesClientUtil
import xquare.app.xquareinfra.infrastructure.vault.VaultUtil
import java.util.UUID

@Transactional
@Service
Expand All @@ -24,11 +25,11 @@ class UpdateEnvironmentVariableService(
private val existsUserTeamPort: ExistsUserTeamPort
): UpdateEnvironmentVariableUseCase {
override fun updateEnvironmentVariable(
deployName: String,
deployId: UUID,
environment: ContainerEnvironment,
environmentVariable: Map<String, String>
) {
val deploy = findDeployPort.findByDeployName(deployName) ?: throw BusinessLogicException.DEPLOY_NOT_FOUND
val deploy = findDeployPort.findById(deployId) ?: throw BusinessLogicException.DEPLOY_NOT_FOUND

val user = readCurrentUserPort.readCurrentUser()
if(!existsUserTeamPort.existsByTeamAndUser(deploy.team, user)) {
Expand Down

0 comments on commit 94f8012

Please sign in to comment.