-
Notifications
You must be signed in to change notification settings - Fork 0
๐ :: [#717] - ๋ณผ๋ฅจ ๋ง์ดํธ API ์ถ๊ฐ #718
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
44de243
[feat] ์ ํ๋ฆฌ์ผ์ด์
์ปจํ
์ด๋ ์์ฑ์ ๋ง์ดํธ๋ ๋ณผ๋ฅจ์ ๋ฐ์ํด์ ์์ฑํ๋ ๋ก์ง ์ถ๊ฐ
dolong2 e2e6f20
[feat] ๋ณผ๋ฅจ ๋ง์ดํธ ์ ๋ณด ์ธ์ด๋ธ ๋ฉ์๋ ์ถ๊ฐ
dolong2 948400d
[feat] ๋ณผ๋ฅจ ๋ง์ดํธ ์์ฒญ dto ์ถ๊ฐ
dolong2 8d8b60e
[feat] ๋ณผ๋ฅจ ๋ง์ดํธ ์ ์ค์ผ์ด์ค ์ถ๊ฐ
dolong2 f0aecea
[feat] ๋ณผ๋ฅจ ๋ง์ดํธ ์์ฒญ ๊ฐ์ฒด ์ถ๊ฐ
dolong2 cddcf30
[feat] ๋ณผ๋ฅจ ๋ง์ดํธ ์๋ํฌ์ธํธ ์ถ๊ฐ
dolong2 9c14412
[feat] ์ปจํ
์ด๋ ์์ฑ ํ
์คํธ์์ ์์กด์ฑ ์ถ๊ฐ
dolong2 9e87857
[test] ๋ณผ๋ฅจ ๋ง์ดํธ ์ ์ค์ผ์ด์ค ํ
์คํธ ์ถ๊ฐ
dolong2 5e9f6be
[test] ๋ณผ๋ฅจ ๋ง์ดํธ ์๋ํฌ์ธํธ ํ
์คํธ ์ถ๊ฐ
dolong2 07c2760
[chore] ๋ณผ๋ฅจ ๊ด๋ จ ํ๋๊ทธ ์ต์
์ ์ฝ๋ฃจํด ์ปจํ
์คํธ์์ ์์ฑํ๋๋ก ์์
dolong2 9663644
[chore] ์ ํ๋ฆฌ์ผ์ด์
๋ฐฐํฌ ์ ์ค์ผ์ด์ค ํ
์คํธ ์์
dolong2 3b12c5d
[feat] ๋ง์ดํธ ๋ณผ๋ฅจ ์์ฒญ์ ๋ง์ดํธ ๊ฒฝ๋ก์ ์ ๊ท์ ์ ์ฉ
dolong2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/kotlin/com/dcd/server/core/domain/volume/dto/request/MountVolumeReqDto.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| package com.dcd.server.core.domain.volume.dto.request | ||
|
|
||
| data class MountVolumeReqDto( | ||
| val mountPath: String, | ||
| val readOnly: Boolean, | ||
| ) | ||
dolong2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
3 changes: 3 additions & 0 deletions
3
src/main/kotlin/com/dcd/server/core/domain/volume/spi/CommandVolumePort.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,12 @@ | ||
| package com.dcd.server.core.domain.volume.spi | ||
|
|
||
| import com.dcd.server.core.domain.volume.model.Volume | ||
| import com.dcd.server.core.domain.volume.model.VolumeMount | ||
|
|
||
| interface CommandVolumePort { | ||
| fun save(volume: Volume) | ||
|
|
||
| fun delete(volume: Volume) | ||
|
|
||
| fun saveMount(volumeMount: VolumeMount) | ||
| } |
52 changes: 52 additions & 0 deletions
52
src/main/kotlin/com/dcd/server/core/domain/volume/usecase/MountVolumeUseCase.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| package com.dcd.server.core.domain.volume.usecase | ||
|
|
||
| import com.dcd.server.core.common.annotation.UseCase | ||
| import com.dcd.server.core.common.data.WorkspaceInfo | ||
| import com.dcd.server.core.domain.application.event.DeployApplicationEvent | ||
| import com.dcd.server.core.domain.application.exception.ApplicationNotFoundException | ||
| import com.dcd.server.core.domain.application.spi.QueryApplicationPort | ||
| import com.dcd.server.core.domain.volume.dto.request.MountVolumeReqDto | ||
| import com.dcd.server.core.domain.volume.exception.VolumeNotFoundException | ||
| import com.dcd.server.core.domain.volume.model.VolumeMount | ||
| import com.dcd.server.core.domain.volume.spi.CommandVolumePort | ||
| import com.dcd.server.core.domain.volume.spi.QueryVolumePort | ||
| import com.dcd.server.core.domain.workspace.exception.WorkspaceNotFoundException | ||
| import org.springframework.context.ApplicationEventPublisher | ||
| import java.util.UUID | ||
|
|
||
| @UseCase | ||
| class MountVolumeUseCase( | ||
| private val queryVolumePort: QueryVolumePort, | ||
| private val queryApplicationPort: QueryApplicationPort, | ||
| private val commandVolumePort: CommandVolumePort, | ||
| private val workspaceInfo: WorkspaceInfo, | ||
| private val eventPublisher: ApplicationEventPublisher, | ||
| ) { | ||
| fun execute(volumeId: UUID, applicationId: String, mountVolumeReqDto: MountVolumeReqDto) { | ||
| val workspace = (workspaceInfo.workspace | ||
| ?: throw WorkspaceNotFoundException()) | ||
|
|
||
| val volume = (queryVolumePort.findById(volumeId) | ||
| ?: throw VolumeNotFoundException()) | ||
|
|
||
| if (volume.workspace != workspace) | ||
| throw VolumeNotFoundException() | ||
dolong2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| val application = (queryApplicationPort.findById(applicationId) | ||
| ?: throw ApplicationNotFoundException()) | ||
| if (application.workspace != workspace) | ||
| throw ApplicationNotFoundException() | ||
|
|
||
| val volumeMount = VolumeMount( | ||
| id = UUID.randomUUID(), | ||
| application = application, | ||
| volume = volume, | ||
| mountPath = mountVolumeReqDto.mountPath, | ||
| readOnly = mountVolumeReqDto.readOnly | ||
| ) | ||
| commandVolumePort.saveMount(volumeMount) | ||
|
|
||
| //๋ง์ดํธ ์์ฑํ ๋์ ์ ํ๋ฆฌ์ผ์ด์ ์ฌ๋ฐฐํฌ | ||
| eventPublisher.publishEvent(DeployApplicationEvent(listOf(application.id))) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/main/kotlin/com/dcd/server/presentation/domain/volume/data/request/MountVolumeRequest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package com.dcd.server.presentation.domain.volume.data.request | ||
|
|
||
| import jakarta.validation.constraints.NotBlank | ||
| import jakarta.validation.constraints.Pattern | ||
|
|
||
| data class MountVolumeRequest( | ||
| @field:NotBlank | ||
| @field:Pattern(regexp = "^(?!(?:/(?:proc|sys|dev|etc)?$))/(?:(?:[A-Za-z0-9._-]+/)*[A-Za-z0-9._-]+)?$") | ||
| val mountPath: String, | ||
| val readOnly: Boolean, | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.