diff --git a/src/main/kotlin/xquare/app/xquareinfra/domain/container/adapter/V1ContainerWebAdapter.kt b/src/main/kotlin/xquare/app/xquareinfra/domain/container/adapter/V1ContainerWebAdapter.kt index 319fa84..8ced130 100644 --- a/src/main/kotlin/xquare/app/xquareinfra/domain/container/adapter/V1ContainerWebAdapter.kt +++ b/src/main/kotlin/xquare/app/xquareinfra/domain/container/adapter/V1ContainerWebAdapter.kt @@ -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 { - 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 ) { - updateEnvironmentVariableUseCase.updateEnvironmentVariable(deployName, environment, environmentVariable) + updateEnvironmentVariableUseCase.updateEnvironmentVariable(deployId, environment, environmentVariable) } @GetMapping diff --git a/src/main/kotlin/xquare/app/xquareinfra/domain/container/application/port/in/GetEnvironmentVariableUseCase.kt b/src/main/kotlin/xquare/app/xquareinfra/domain/container/application/port/in/GetEnvironmentVariableUseCase.kt index 2d92e2a..8e79b66 100644 --- a/src/main/kotlin/xquare/app/xquareinfra/domain/container/application/port/in/GetEnvironmentVariableUseCase.kt +++ b/src/main/kotlin/xquare/app/xquareinfra/domain/container/application/port/in/GetEnvironmentVariableUseCase.kt @@ -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 + fun getEnvironmentVariable(deployId: UUID, environment: ContainerEnvironment): Map } \ No newline at end of file diff --git a/src/main/kotlin/xquare/app/xquareinfra/domain/container/application/port/in/UpdateEnvironmentVariableUseCase.kt b/src/main/kotlin/xquare/app/xquareinfra/domain/container/application/port/in/UpdateEnvironmentVariableUseCase.kt index d7aca41..18d1fbc 100644 --- a/src/main/kotlin/xquare/app/xquareinfra/domain/container/application/port/in/UpdateEnvironmentVariableUseCase.kt +++ b/src/main/kotlin/xquare/app/xquareinfra/domain/container/application/port/in/UpdateEnvironmentVariableUseCase.kt @@ -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) + fun updateEnvironmentVariable(deployId: UUID, environment: ContainerEnvironment, environmentVariable: Map) } \ No newline at end of file diff --git a/src/main/kotlin/xquare/app/xquareinfra/domain/container/application/service/GetEnvironmentVariableService.kt b/src/main/kotlin/xquare/app/xquareinfra/domain/container/application/service/GetEnvironmentVariableService.kt index 82ac85a..cc53f5b 100644 --- a/src/main/kotlin/xquare/app/xquareinfra/domain/container/application/service/GetEnvironmentVariableService.kt +++ b/src/main/kotlin/xquare/app/xquareinfra/domain/container/application/service/GetEnvironmentVariableService.kt @@ -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( @@ -17,8 +18,8 @@ class GetEnvironmentVariableService( private val existsUserTeamPort: ExistsUserTeamPort, private val readCurrentUserPort: ReadCurrentUserPort ): GetEnvironmentVariableUseCase { - override fun getEnvironmentVariable(deployName: String, environment: ContainerEnvironment): Map { - val deploy = findDeployPort.findByDeployName(deployName) ?: throw BusinessLogicException.DEPLOY_NOT_FOUND + override fun getEnvironmentVariable(deployId: UUID, environment: ContainerEnvironment): Map { + val deploy = findDeployPort.findById(deployId) ?: throw BusinessLogicException.DEPLOY_NOT_FOUND val user = readCurrentUserPort.readCurrentUser() if(!existsUserTeamPort.existsByTeamAndUser(deploy.team, user)) { diff --git a/src/main/kotlin/xquare/app/xquareinfra/domain/container/application/service/UpdateEnvironmentVariableService.kt b/src/main/kotlin/xquare/app/xquareinfra/domain/container/application/service/UpdateEnvironmentVariableService.kt index ae01595..a17c10e 100644 --- a/src/main/kotlin/xquare/app/xquareinfra/domain/container/application/service/UpdateEnvironmentVariableService.kt +++ b/src/main/kotlin/xquare/app/xquareinfra/domain/container/application/service/UpdateEnvironmentVariableService.kt @@ -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 @@ -24,11 +25,11 @@ class UpdateEnvironmentVariableService( private val existsUserTeamPort: ExistsUserTeamPort ): UpdateEnvironmentVariableUseCase { override fun updateEnvironmentVariable( - deployName: String, + deployId: UUID, environment: ContainerEnvironment, environmentVariable: Map ) { - 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)) {