-
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.
merge :: (#16) 행사일정 수정 api
- Loading branch information
Showing
7 changed files
with
109 additions
and
7 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
...n/com/kodomo/juganbbojjak/domain/event_schedule/dto/request/UpdateEventScheduleRequest.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,10 @@ | ||
package com.kodomo.juganbbojjak.domain.event_schedule.dto.request | ||
|
||
import java.time.LocalDate | ||
|
||
data class UpdateEventScheduleRequest( | ||
val date: LocalDate, | ||
val name: String, | ||
val place: String, | ||
val headcount: Int, | ||
) |
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
29 changes: 29 additions & 0 deletions
29
...otlin/com/kodomo/juganbbojjak/domain/event_schedule/usecase/UpdateEventScheduleUseCase.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,29 @@ | ||
package com.kodomo.juganbbojjak.domain.event_schedule.usecase | ||
|
||
import com.kodomo.juganbbojjak.common.annotation.UseCase | ||
import com.kodomo.juganbbojjak.domain.event_schedule.dto.request.UpdateEventScheduleRequest | ||
import com.kodomo.juganbbojjak.domain.event_schedule.exception.EventScheduleNotFoundException | ||
import com.kodomo.juganbbojjak.domain.event_schedule.spi.CommandEventSchedulePort | ||
import com.kodomo.juganbbojjak.domain.event_schedule.spi.QueryEventSchedulePort | ||
import java.util.UUID | ||
|
||
@UseCase | ||
class UpdateEventScheduleUseCase( | ||
private val queryEventSchedulePort: QueryEventSchedulePort, | ||
private val commandEventSchedulePort: CommandEventSchedulePort, | ||
) { | ||
|
||
fun execute(eventScheduleId: UUID, request: UpdateEventScheduleRequest) { | ||
val eventSchedule = queryEventSchedulePort.queryEventScheduleById(eventScheduleId) | ||
?: throw EventScheduleNotFoundException | ||
|
||
commandEventSchedulePort.saveEventSchedule( | ||
eventSchedule.update( | ||
date = request.date, | ||
name = request.name, | ||
place = request.place, | ||
headcount = request.headcount, | ||
) | ||
) | ||
} | ||
} |
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
29 changes: 29 additions & 0 deletions
29
...domo/juganbbojjak/domain/event_schedule/presentation/dto/UpdateEventScheduleWebRequest.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,29 @@ | ||
package com.kodomo.juganbbojjak.domain.event_schedule.presentation.dto | ||
|
||
import com.kodomo.juganbbojjak.domain.event_schedule.dto.request.UpdateEventScheduleRequest | ||
import jakarta.validation.constraints.NotBlank | ||
import jakarta.validation.constraints.NotNull | ||
import java.time.LocalDate | ||
|
||
data class UpdateEventScheduleWebRequest( | ||
|
||
@field:NotNull | ||
val date: LocalDate, | ||
|
||
@field:NotBlank | ||
val name: String, | ||
|
||
@field:NotBlank | ||
val place: String, | ||
|
||
@field:NotNull | ||
val headcount: Int, | ||
) { | ||
|
||
fun toDomainRequest() = UpdateEventScheduleRequest( | ||
date = date, | ||
name = name, | ||
place = place, | ||
headcount = headcount, | ||
) | ||
} |