diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/common/WebCommonAdapter.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/common/WebCommonAdapter.kt index ecd0c805..d0a30b6c 100644 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/common/WebCommonAdapter.kt +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/common/WebCommonAdapter.kt @@ -6,12 +6,13 @@ import org.springframework.web.bind.annotation.* import team.comit.simtong.domain.auth.dto.TokenResponse import team.comit.simtong.domain.auth.usecase.ReissueTokenUseCase import team.comit.simtong.domain.common.dto.request.ChangePasswordWebRequest +import team.comit.simtong.domain.common.dto.request.CheckMatchedAccountWebRequest import team.comit.simtong.domain.common.dto.request.FindEmployeeNumberWebRequest import team.comit.simtong.domain.common.dto.request.ResetPasswordWebRequest import team.comit.simtong.domain.common.dto.response.FindEmployeeNumberWebResponse -import team.comit.simtong.domain.spot.dto.SpotResponse +import team.comit.simtong.domain.common.dto.response.QueryTeamsWebResponse +import team.comit.simtong.domain.common.dto.response.SpotWebResponse import team.comit.simtong.domain.spot.usecase.ShowSpotListUseCase -import team.comit.simtong.domain.team.dto.QueryTeamsResponse import team.comit.simtong.domain.team.usecase.QueryTeamsUseCase import team.comit.simtong.domain.user.dto.ChangePasswordRequest import team.comit.simtong.domain.user.dto.CheckMatchedAccountRequest @@ -53,15 +54,13 @@ class WebCommonAdapter( @GetMapping("/employee-number") fun findEmployeeNumber(@Valid @ModelAttribute request: FindEmployeeNumberWebRequest): FindEmployeeNumberWebResponse { - val result = findEmployeeNumberUseCase.execute( + return findEmployeeNumberUseCase.execute( FindEmployeeNumberRequest( name = request.name, spotId = request.spotId, email = request.email ) - ) - - return FindEmployeeNumberWebResponse(result) + ).run(::FindEmployeeNumberWebResponse) } @PutMapping("/token/reissue") @@ -98,7 +97,7 @@ class WebCommonAdapter( } @GetMapping("/account/existence") - fun checkMatchedAccount(@Valid @ModelAttribute request: CheckMatchedAccountRequest) { + fun checkMatchedAccount(@Valid @ModelAttribute request: CheckMatchedAccountWebRequest) { checkMatchedAccountUseCase.execute( CheckMatchedAccountRequest( employeeNumber = request.employeeNumber, @@ -108,8 +107,16 @@ class WebCommonAdapter( } @GetMapping("/spot") - fun showSpotList(): SpotResponse { + fun showSpotList(): SpotWebResponse { return showSpotListUseCase.execute() + .map { + SpotWebResponse.SpotElement( + id = it.id, + name = it.name, + location = it.location + ) + } + .run(::SpotWebResponse) } @GetMapping("/password/compare") @@ -118,8 +125,14 @@ class WebCommonAdapter( } @GetMapping("/team/{spot-id}") - fun queryTeams(@PathVariable(name = "spot-id") spotId: UUID): QueryTeamsResponse { + fun queryTeams(@PathVariable(name = "spot-id") spotId: UUID): QueryTeamsWebResponse { return queryTeamsUseCase.execute(spotId) + .map { + QueryTeamsWebResponse.TeamElement( + id = it.id, + name = it.name + ) + } + .run(::QueryTeamsWebResponse) } - } \ No newline at end of file diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/WebFileAdapter.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/WebFileAdapter.kt index c7871f60..2f77556a 100644 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/WebFileAdapter.kt +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/WebFileAdapter.kt @@ -6,10 +6,10 @@ import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.ResponseStatus import org.springframework.web.bind.annotation.RestController import org.springframework.web.multipart.MultipartFile -import team.comit.simtong.domain.file.dto.response.UploadImageListWebResponse -import team.comit.simtong.domain.file.dto.response.UploadImageWebResponse import team.comit.simtong.domain.file.converter.ExcelFileConverter import team.comit.simtong.domain.file.converter.ImageFileConverter +import team.comit.simtong.domain.file.dto.response.UploadImageListWebResponse +import team.comit.simtong.domain.file.dto.response.UploadImageWebResponse import team.comit.simtong.domain.file.usecase.RegisterEmployeeCertificateUseCase import team.comit.simtong.domain.file.usecase.UploadImageUseCase @@ -31,21 +31,17 @@ class WebFileAdapter( @PostMapping @ResponseStatus(HttpStatus.CREATED) fun uploadSingleImage(file: MultipartFile): UploadImageWebResponse { - return UploadImageWebResponse( - uploadImageUseCase.execute( - file.let(ImageFileConverter::transferTo) - ) - ) + return uploadImageUseCase.execute( + file.let(ImageFileConverter::transferTo) + ).run(::UploadImageWebResponse) } @PostMapping("/list") @ResponseStatus(HttpStatus.CREATED) fun uploadMultipleImage(files: List): UploadImageListWebResponse { - return UploadImageListWebResponse( - uploadImageUseCase.execute( - files.let(ImageFileConverter::transferToList) - ) - ) + return uploadImageUseCase.execute( + files.let(ImageFileConverter::transferToList) + ).run(::UploadImageListWebResponse) } @PostMapping("/employee") diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/holiday/WebHolidayAdapter.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/holiday/WebHolidayAdapter.kt index 034da0cc..78944d8b 100644 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/holiday/WebHolidayAdapter.kt +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/holiday/WebHolidayAdapter.kt @@ -10,8 +10,7 @@ import org.springframework.web.bind.annotation.RequestParam import org.springframework.web.bind.annotation.ResponseStatus import org.springframework.web.bind.annotation.RestController import team.comit.simtong.domain.holiday.dto.AppointHolidayPeriodRequest -import team.comit.simtong.domain.holiday.dto.QueryEmployeeHolidayResponse -import team.comit.simtong.domain.holiday.dto.QueryIndividualHolidaysResponse +import team.comit.simtong.domain.holiday.dto.response.QueryEmployeeHolidayWebResponse import team.comit.simtong.domain.holiday.dto.QueryIndividualRequest import team.comit.simtong.domain.holiday.dto.QueryMonthHolidayPeriodResponse import team.comit.simtong.domain.holiday.dto.request.AppointAnnualWebRequest @@ -20,9 +19,13 @@ import team.comit.simtong.domain.holiday.dto.request.AppointHolidayWebRequest import team.comit.simtong.domain.holiday.dto.request.CancelHolidayWebRequest import team.comit.simtong.domain.holiday.dto.request.ChangeEmployeeHolidayWebRequest import team.comit.simtong.domain.holiday.dto.request.ShareHolidayWebRequest +import team.comit.simtong.domain.holiday.dto.response.IndividualHolidayResponse +import team.comit.simtong.domain.holiday.dto.response.QueryIndividualHolidaysWebResponse import team.comit.simtong.domain.holiday.dto.response.QueryRemainAnnualWebResponse +import team.comit.simtong.domain.holiday.model.Holiday import team.comit.simtong.domain.holiday.model.value.HolidayQueryType import team.comit.simtong.domain.holiday.model.value.HolidayStatus +import team.comit.simtong.domain.holiday.spi.vo.EmployeeHoliday import team.comit.simtong.domain.holiday.usecase.AppointAnnualUseCase import team.comit.simtong.domain.holiday.usecase.AppointHolidayPeriodUseCase import team.comit.simtong.domain.holiday.usecase.AppointHolidayUseCase @@ -65,9 +68,8 @@ class WebHolidayAdapter( @GetMapping("/annual/count") fun queryRemainAnnual(@RequestParam year: Int): QueryRemainAnnualWebResponse { - return QueryRemainAnnualWebResponse( - queryRemainAnnualUseCase.execute(year) - ) + return queryRemainAnnualUseCase.execute(year) + .run(::QueryRemainAnnualWebResponse) } @PostMapping("/annual") @@ -92,14 +94,21 @@ class WebHolidayAdapter( @RequestParam("start_at") startAt: LocalDate, @RequestParam("end_at") endAt: LocalDate, @RequestParam status: HolidayStatus - ): QueryIndividualHolidaysResponse { - return queryIndividualHolidayUseCase.execute( + ): QueryIndividualHolidaysWebResponse { + val result: List = queryIndividualHolidayUseCase.execute( QueryIndividualRequest( startAt = startAt, endAt = endAt, - status = status.name + status = status ) ) + + return result.map { + IndividualHolidayResponse( + date = it.date, + type = it.type + ) + }.run(::QueryIndividualHolidaysWebResponse) } @PutMapping("/public") @@ -122,13 +131,26 @@ class WebHolidayAdapter( @RequestParam month: Int, @RequestParam type: HolidayQueryType, @RequestParam("team_id", required = false) teamId: UUID? - ): QueryEmployeeHolidayResponse { - return queryEmployeeHolidayUseCase.execute( + ): QueryEmployeeHolidayWebResponse { + val result: List = queryEmployeeHolidayUseCase.execute( year = year, month = month, type = type, teamId = teamId ) + + return result.map { + QueryEmployeeHolidayWebResponse.Holiday( + date = it.date, + type = it.type, + user = QueryEmployeeHolidayWebResponse.Holiday.Employee( + id = it.userId, + name = it.userName, + team = it.teamName, + spot = it.spotName + ) + ) + }.run(::QueryEmployeeHolidayWebResponse) } @PutMapping("/employee") diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/menu/WebMenuAdapter.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/menu/WebMenuAdapter.kt index d518e126..d004733a 100644 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/menu/WebMenuAdapter.kt +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/menu/WebMenuAdapter.kt @@ -8,9 +8,9 @@ import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RequestParam import org.springframework.web.bind.annotation.RestController import team.comit.simtong.domain.file.converter.ExcelFileConverter -import team.comit.simtong.domain.menu.dto.MenuResponse import team.comit.simtong.domain.menu.dto.SaveMenuRequest import team.comit.simtong.domain.menu.dto.request.SaveMenuWebRequest +import team.comit.simtong.domain.menu.dto.response.MenuWebResponse import team.comit.simtong.domain.menu.usecase.QueryMenuByMonthUseCase import team.comit.simtong.domain.menu.usecase.QueryPublicMenuUseCase import team.comit.simtong.domain.menu.usecase.SaveMenuUseCase @@ -25,7 +25,7 @@ import javax.validation.Valid * @author kimbeomjin * @author Chokyunghyeon * @date 2022/09/25 - * @version 1.0.0 + * @version 1.2.5 **/ @RestController @RequestMapping("/menu") @@ -39,16 +39,30 @@ class WebMenuAdapter( fun getMenu( @RequestParam("start_at") startAt: LocalDate, @RequestParam("end_at") endAt: LocalDate - ): MenuResponse { + ): MenuWebResponse { return queryMenuByMonthUseCase.execute(startAt, endAt) + .map { + MenuWebResponse.MenuElement( + date = it.date, + meal = it.meal + ) + } + .run(::MenuWebResponse) } @GetMapping("/public") fun getPublicMenu( @RequestParam("start_at") startAt: LocalDate, @RequestParam("end_at") endAt: LocalDate - ): MenuResponse { + ): MenuWebResponse { return queryPublicMenuUseCase.execute(startAt, endAt) + .map { + MenuWebResponse.MenuElement( + date = it.date, + meal = it.meal + ) + } + .run(::MenuWebResponse) } @PostMapping("/{spot-id}") diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/schedule/WebScheduleAdapter.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/schedule/WebScheduleAdapter.kt index 02062241..ea368fa5 100644 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/schedule/WebScheduleAdapter.kt +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/schedule/WebScheduleAdapter.kt @@ -15,12 +15,16 @@ import team.comit.simtong.domain.schedule.dto.AddIndividualScheduleRequest import team.comit.simtong.domain.schedule.dto.AddSpotScheduleRequest import team.comit.simtong.domain.schedule.dto.ChangeIndividualScheduleRequest import team.comit.simtong.domain.schedule.dto.ChangeSpotScheduleRequest -import team.comit.simtong.domain.schedule.dto.QueryEntireSpotScheduleResponse -import team.comit.simtong.domain.schedule.dto.QueryIndividualSpotScheduleResponse import team.comit.simtong.domain.schedule.dto.request.AddIndividualScheduleWebRequest import team.comit.simtong.domain.schedule.dto.request.AddSpotScheduleWebRequest import team.comit.simtong.domain.schedule.dto.request.ChangeIndividualScheduleWebRequest import team.comit.simtong.domain.schedule.dto.request.ChangeSpotScheduleWebRequest +import team.comit.simtong.domain.schedule.dto.response.QueryEntireSpotScheduleWebResponse +import team.comit.simtong.domain.schedule.dto.response.QueryIndividualSpotScheduleWebResponse +import team.comit.simtong.domain.schedule.dto.response.ScheduleResponse +import team.comit.simtong.domain.schedule.dto.response.SpotScheduleResponse +import team.comit.simtong.domain.schedule.model.Schedule +import team.comit.simtong.domain.schedule.spi.vo.SpotSchedule import team.comit.simtong.domain.schedule.usecase.AddIndividualScheduleUseCase import team.comit.simtong.domain.schedule.usecase.AddSpotScheduleUseCase import team.comit.simtong.domain.schedule.usecase.ChangeIndividualScheduleUseCase @@ -88,16 +92,39 @@ class WebScheduleAdapter( fun queryIndividualSpotSchedule( @RequestParam("start_at") startAt: LocalDate, @RequestParam("end_at") endAt: LocalDate - ): QueryIndividualSpotScheduleResponse { - return queryIndividualSpotScheduleUseCase.execute(startAt, endAt) + ): QueryIndividualSpotScheduleWebResponse { + val result: List = queryIndividualSpotScheduleUseCase.execute(startAt, endAt) + + return result.map { + ScheduleResponse( + id = it.id, + startAt = it.startAt, + endAt = it.endAt, + title = it.title, + scope = it.scope + ) + }.run(::QueryIndividualSpotScheduleWebResponse) } @GetMapping("/spots") fun queryEntireSpotSchedule( @RequestParam("start_at") startAt: LocalDate, @RequestParam("end_at") endAt: LocalDate - ): QueryEntireSpotScheduleResponse { - return queryEntireSpotScheduleUseCase.execute(startAt, endAt) + ): QueryEntireSpotScheduleWebResponse { + val result: List = queryEntireSpotScheduleUseCase.execute(startAt, endAt) + + return result.map { + SpotScheduleResponse( + id = it.id, + title = it.title, + startAt = it.startAt, + endAt = it.endAt, + spot = SpotScheduleResponse.SpotElement( + id = it.spotId, + name = it.spotName + ) + ) + }.run(::QueryEntireSpotScheduleWebResponse) } @PostMapping("/spots/{spot-id}")