-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
13 changed files
with
156 additions
and
16 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
.../kotlin/com/kodomo/juganbbojjak/domain/work_report/dto/request/UpdateWorkReportRequest.kt
This file contains 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,15 @@ | ||
package com.kodomo.juganbbojjak.domain.work_report.dto.request | ||
|
||
import java.util.UUID | ||
|
||
data class UpdateWorkReportRequest( | ||
val workReportId: UUID, | ||
val title: String, | ||
val workReportDetails: List<UpdateWorkReportDetailsRequest> | ||
) | ||
|
||
data class UpdateWorkReportDetailsRequest( | ||
val workDetailId: UUID, | ||
val contentKey: String, | ||
val contentValue: String | ||
) |
8 changes: 8 additions & 0 deletions
8
...otlin/com/kodomo/juganbbojjak/domain/work_report/exception/WorkDetailNotFoundException.kt
This file contains 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,8 @@ | ||
package com.kodomo.juganbbojjak.domain.work_report.exception | ||
|
||
import com.kodomo.juganbbojjak.common.error.JuGanBbojjakException | ||
import com.kodomo.juganbbojjak.domain.work_report.exception.error.WorkReportErrorCode | ||
|
||
object WorkDetailNotFoundException : JuGanBbojjakException( | ||
WorkReportErrorCode.WORK_DETAIL_NOT_FOUND | ||
) |
This file contains 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 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 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 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 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
32 changes: 32 additions & 0 deletions
32
...main/kotlin/com/kodomo/juganbbojjak/domain/work_report/usecase/UpdateWorkReportUseCase.kt
This file contains 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,32 @@ | ||
package com.kodomo.juganbbojjak.domain.work_report.usecase | ||
|
||
import com.kodomo.juganbbojjak.common.annotation.UseCase | ||
import com.kodomo.juganbbojjak.domain.work_report.dto.request.UpdateWorkReportRequest | ||
import com.kodomo.juganbbojjak.domain.work_report.spi.CommandWorkDetailPort | ||
import com.kodomo.juganbbojjak.domain.work_report.spi.CommandWorkReportPort | ||
import com.kodomo.juganbbojjak.domain.work_report.spi.QueryWorkDetailPort | ||
import com.kodomo.juganbbojjak.domain.work_report.spi.QueryWorkReportPort | ||
|
||
@UseCase | ||
class UpdateWorkReportUseCase( | ||
private val queryWorkReportPort: QueryWorkReportPort, | ||
private val commandWorkReportPort: CommandWorkReportPort, | ||
private val queryWorkDetailPort: QueryWorkDetailPort, | ||
private val commandWorkDetailPort: CommandWorkDetailPort | ||
) { | ||
|
||
fun execute(request: UpdateWorkReportRequest) { | ||
val workReportEntity = queryWorkReportPort.queryWorkReportById(request.workReportId) | ||
|
||
commandWorkReportPort.saveWorkReport(workReportEntity.updateWorkReport(request.title)) | ||
|
||
request.workReportDetails.forEach { workReportDetails -> | ||
val workDetailList = | ||
queryWorkDetailPort.queryWorkDetailById(workReportDetails.workDetailId) | ||
|
||
commandWorkDetailPort.saveWorkDetail( | ||
workDetailList.updateWorkDetail(workReportDetails) | ||
) | ||
} | ||
} | ||
} |
This file contains 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 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 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 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
42 changes: 42 additions & 0 deletions
42
...com/kodomo/juganbbojjak/domain/work_report/presentation/dto/UpdateWorkReportWebRequest.kt
This file contains 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,42 @@ | ||
package com.kodomo.juganbbojjak.domain.work_report.presentation.dto | ||
|
||
import com.kodomo.juganbbojjak.domain.work_report.dto.request.UpdateWorkReportDetailsRequest | ||
import com.kodomo.juganbbojjak.domain.work_report.dto.request.UpdateWorkReportRequest | ||
import jakarta.validation.constraints.NotBlank | ||
import jakarta.validation.constraints.NotNull | ||
import java.util.* | ||
|
||
data class UpdateWorkReportWebRequest( | ||
|
||
@NotBlank | ||
val workReportId: UUID, | ||
|
||
@NotBlank | ||
val title: String, | ||
|
||
val workReportDetails: List<@NotNull UpdateWorkReportDetailsWebRequest> | ||
) { | ||
fun toDomainRequest() = UpdateWorkReportRequest( | ||
workReportId = workReportId, | ||
title = title, | ||
workReportDetails = workReportDetails.map { | ||
UpdateWorkReportDetailsRequest( | ||
workDetailId = it.workDetailId, | ||
contentKey = it.contentKey, | ||
contentValue = it.contentValue | ||
) | ||
} | ||
) | ||
} | ||
|
||
data class UpdateWorkReportDetailsWebRequest( | ||
|
||
@NotBlank | ||
val workDetailId: UUID, | ||
|
||
@NotBlank | ||
val contentKey: String, | ||
|
||
@NotBlank | ||
val contentValue: String | ||
) |