-
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
16 changed files
with
190 additions
and
17 deletions.
There are no files selected for viewing
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
13 changes: 13 additions & 0 deletions
13
...c/main/kotlin/com/kodomo/juganbbojjak/domain/user/dto/response/QueryLatestWorkResponse.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,13 @@ | ||
package com.kodomo.juganbbojjak.domain.user.dto.response | ||
|
||
import java.time.LocalDate | ||
import java.util.UUID | ||
|
||
data class QueryLatestWorkResponse( | ||
val workReportId: UUID, | ||
val workReportStartDate: LocalDate, | ||
val workReportEndDate: LocalDate, | ||
val eventScheduleId: UUID, | ||
val eventScheduleStartDate: LocalDate, | ||
val eventScheduleEndDate: LocalDate | ||
) |
16 changes: 16 additions & 0 deletions
16
...c/main/kotlin/com/kodomo/juganbbojjak/domain/user/dto/response/QueryWeeklyListResponse.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,16 @@ | ||
package com.kodomo.juganbbojjak.domain.user.dto.response | ||
|
||
import com.kodomo.juganbbojjak.domain.user.model.WeeklyListType | ||
import java.time.LocalDate | ||
import java.util.UUID | ||
|
||
data class QueryWeeklyListResponse ( | ||
val weeklyList: List<WeeklyList> | ||
) | ||
|
||
data class WeeklyList( | ||
val id: UUID, | ||
val startDate: LocalDate, | ||
val endDate: LocalDate, | ||
val type: WeeklyListType | ||
) |
5 changes: 5 additions & 0 deletions
5
...k-application/src/main/kotlin/com/kodomo/juganbbojjak/domain/user/model/WeeklyListType.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,5 @@ | ||
package com.kodomo.juganbbojjak.domain.user.model | ||
|
||
enum class WeeklyListType { | ||
WORK_REPORT, EVENT_SCHEDULE | ||
} |
29 changes: 29 additions & 0 deletions
29
...ion/src/main/kotlin/com/kodomo/juganbbojjak/domain/user/usecase/QueryLatestWorkUseCase.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.user.usecase | ||
|
||
import com.kodomo.juganbbojjak.common.annotation.UseCase | ||
import com.kodomo.juganbbojjak.domain.event_schedule.exception.WeeklyEventScheduleNotFoundException | ||
import com.kodomo.juganbbojjak.domain.event_schedule.spi.QueryEventSchedulePort | ||
import com.kodomo.juganbbojjak.domain.user.dto.response.QueryLatestWorkResponse | ||
import com.kodomo.juganbbojjak.domain.work_report.spi.QueryWeeklyWorkReportPort | ||
|
||
@UseCase | ||
class QueryLatestWorkUseCase( | ||
private val queryWeeklyWorkReportPort: QueryWeeklyWorkReportPort, | ||
private val queryEventSchedulePort: QueryEventSchedulePort | ||
) { | ||
|
||
fun execute(): QueryLatestWorkResponse { | ||
val weeklyWorkReport = queryWeeklyWorkReportPort.queryLatestWeeklyWorkReport() | ||
val eventSchedule = queryEventSchedulePort.queryLatestEventSchedule() | ||
?: throw WeeklyEventScheduleNotFoundException | ||
|
||
return QueryLatestWorkResponse( | ||
workReportId = weeklyWorkReport.id, | ||
workReportStartDate = weeklyWorkReport.startDate, | ||
workReportEndDate = weeklyWorkReport.endDate, | ||
eventScheduleId = eventSchedule.id, | ||
eventScheduleStartDate = eventSchedule.startDate, | ||
eventScheduleEndDate = eventSchedule.endDate | ||
) | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...ion/src/main/kotlin/com/kodomo/juganbbojjak/domain/user/usecase/QueryWeeklyListUseCase.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,43 @@ | ||
package com.kodomo.juganbbojjak.domain.user.usecase | ||
|
||
import com.kodomo.juganbbojjak.common.annotation.UseCase | ||
import com.kodomo.juganbbojjak.domain.event_schedule.spi.QueryEventSchedulePort | ||
import com.kodomo.juganbbojjak.domain.user.dto.response.QueryWeeklyListResponse | ||
import com.kodomo.juganbbojjak.domain.user.dto.response.WeeklyList | ||
import com.kodomo.juganbbojjak.domain.user.model.WeeklyListType | ||
import com.kodomo.juganbbojjak.domain.user.model.WeeklyListType.EVENT_SCHEDULE | ||
import com.kodomo.juganbbojjak.domain.user.model.WeeklyListType.WORK_REPORT | ||
import com.kodomo.juganbbojjak.domain.work_report.spi.QueryWeeklyWorkReportPort | ||
|
||
@UseCase | ||
class QueryWeeklyListUseCase( | ||
private val queryWeeklyWorkReportPort: QueryWeeklyWorkReportPort, | ||
private val queryWeeklySchedulePort: QueryEventSchedulePort | ||
) { | ||
|
||
fun execute(weeklyListType: WeeklyListType): QueryWeeklyListResponse = | ||
|
||
when (weeklyListType) { | ||
WORK_REPORT -> QueryWeeklyListResponse( | ||
queryWeeklyWorkReportPort.queryAllWeeklyWorkReportList().map { | ||
WeeklyList( | ||
id = it.id, | ||
startDate = it.startDate, | ||
endDate = it.endDate, | ||
type = WORK_REPORT | ||
) | ||
} | ||
) | ||
|
||
EVENT_SCHEDULE -> QueryWeeklyListResponse( | ||
queryWeeklySchedulePort.queryAllEventScheduleList().map { | ||
WeeklyList( | ||
id = it.id, | ||
startDate = it.startDate, | ||
endDate = it.endDate, | ||
type = EVENT_SCHEDULE | ||
) | ||
} | ||
) | ||
} | ||
} |
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
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
28 changes: 28 additions & 0 deletions
28
...ucture/src/main/kotlin/com/kodomo/juganbbojjak/domain/user/presentation/UserWebAdapter.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,28 @@ | ||
package com.kodomo.juganbbojjak.domain.user.presentation | ||
|
||
import com.kodomo.juganbbojjak.domain.user.dto.response.QueryLatestWorkResponse | ||
import com.kodomo.juganbbojjak.domain.user.dto.response.QueryWeeklyListResponse | ||
import com.kodomo.juganbbojjak.domain.user.model.WeeklyListType | ||
import com.kodomo.juganbbojjak.domain.user.usecase.QueryLatestWorkUseCase | ||
import com.kodomo.juganbbojjak.domain.user.usecase.QueryWeeklyListUseCase | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RequestParam | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RequestMapping("/main") | ||
@RestController | ||
class UserWebAdapter( | ||
private val queryWeeklyListUseCase: QueryWeeklyListUseCase, | ||
private val queryLatestWorkUseCase: QueryLatestWorkUseCase | ||
) { | ||
|
||
@GetMapping | ||
fun queryWeeklyList(@RequestParam("weekly-list-type") weeklyListType: WeeklyListType): QueryWeeklyListResponse = | ||
queryWeeklyListUseCase.execute(weeklyListType) | ||
|
||
@GetMapping("/latest_work") | ||
fun queryLatestWork(): QueryLatestWorkResponse = | ||
queryLatestWorkUseCase.execute() | ||
|
||
} |
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