Skip to content

Commit

Permalink
revert: (#281) presentation response 되돌리기
Browse files Browse the repository at this point in the history
  • Loading branch information
khcho0125 committed Jan 11, 2023
1 parent d10ca73 commit 95b3e04
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 140 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@ package team.comit.simtong.domain.common
import org.springframework.http.HttpStatus
import org.springframework.validation.annotation.Validated
import org.springframework.web.bind.annotation.*
import team.comit.simtong.domain.auth.dto.TokenResponse
import team.comit.simtong.domain.auth.dto.response.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.common.dto.response.QueryTeamsWebResponse
import team.comit.simtong.domain.common.dto.response.SpotWebResponse
import team.comit.simtong.domain.common.dto.ChangePasswordWebRequest
import team.comit.simtong.domain.common.dto.FindEmployeeNumberWebRequest
import team.comit.simtong.domain.common.dto.ResetPasswordWebRequest
import team.comit.simtong.domain.spot.dto.response.QuerySpotsResponse
import team.comit.simtong.domain.spot.usecase.ShowSpotListUseCase
import team.comit.simtong.domain.team.dto.response.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
import team.comit.simtong.domain.user.dto.FindEmployeeNumberRequest
import team.comit.simtong.domain.user.dto.ResetPasswordRequest
import team.comit.simtong.domain.user.dto.request.ChangePasswordRequest
import team.comit.simtong.domain.user.dto.request.CheckMatchedAccountRequest
import team.comit.simtong.domain.user.dto.request.FindEmployeeNumberRequest
import team.comit.simtong.domain.user.dto.response.FindEmployeeNumberResponse
import team.comit.simtong.domain.user.dto.request.ResetPasswordRequest
import team.comit.simtong.domain.user.usecase.ChangePasswordUseCase
import team.comit.simtong.domain.user.usecase.CheckEmailDuplicationUseCase
import team.comit.simtong.domain.user.usecase.CheckMatchedAccountUseCase
Expand Down Expand Up @@ -53,14 +52,14 @@ class WebCommonAdapter(
) {

@GetMapping("/employee-number")
fun findEmployeeNumber(@Valid @ModelAttribute request: FindEmployeeNumberWebRequest): FindEmployeeNumberWebResponse {
fun findEmployeeNumber(@Valid @ModelAttribute request: FindEmployeeNumberWebRequest): FindEmployeeNumberResponse {
return findEmployeeNumberUseCase.execute(
FindEmployeeNumberRequest(
name = request.name,
spotId = request.spotId,
email = request.email
)
).run(::FindEmployeeNumberWebResponse)
)
}

@PutMapping("/token/reissue")
Expand Down Expand Up @@ -97,7 +96,7 @@ class WebCommonAdapter(
}

@GetMapping("/account/existence")
fun checkMatchedAccount(@Valid @ModelAttribute request: CheckMatchedAccountWebRequest) {
fun checkMatchedAccount(@Valid @ModelAttribute request: CheckMatchedAccountRequest) {
checkMatchedAccountUseCase.execute(
CheckMatchedAccountRequest(
employeeNumber = request.employeeNumber,
Expand All @@ -107,16 +106,8 @@ class WebCommonAdapter(
}

@GetMapping("/spot")
fun showSpotList(): SpotWebResponse {
fun showSpotList(): QuerySpotsResponse {
return showSpotListUseCase.execute()
.map {
SpotWebResponse.SpotElement(
id = it.id,
name = it.name,
location = it.location
)
}
.run(::SpotWebResponse)
}

@GetMapping("/password/compare")
Expand All @@ -125,14 +116,8 @@ class WebCommonAdapter(
}

@GetMapping("/team/{spot-id}")
fun queryTeams(@PathVariable(name = "spot-id") spotId: UUID): QueryTeamsWebResponse {
fun queryTeams(@PathVariable(name = "spot-id") spotId: UUID): QueryTeamsResponse {
return queryTeamsUseCase.execute(spotId)
.map {
QueryTeamsWebResponse.TeamElement(
id = it.id,
name = it.name
)
}
.run(::QueryTeamsWebResponse)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import org.springframework.web.bind.annotation.RestController
import org.springframework.web.multipart.MultipartFile
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.dto.response.UploadImageListResponse
import team.comit.simtong.domain.file.dto.response.UploadImageResponse
import team.comit.simtong.domain.file.usecase.RegisterEmployeeCertificateUseCase
import team.comit.simtong.domain.file.usecase.UploadImageUseCase

Expand All @@ -19,7 +19,7 @@ import team.comit.simtong.domain.file.usecase.UploadImageUseCase
*
* @author Chokyunghyeon
* @date 2022/09/21
* @version 1.0.0
* @version 1.2.5
**/
@RestController
@RequestMapping("/files")
Expand All @@ -30,18 +30,18 @@ class WebFileAdapter(

@PostMapping
@ResponseStatus(HttpStatus.CREATED)
fun uploadSingleImage(file: MultipartFile): UploadImageWebResponse {
fun uploadSingleImage(file: MultipartFile): UploadImageResponse {
return uploadImageUseCase.execute(
file.let(ImageFileConverter::transferTo)
).run(::UploadImageWebResponse)
)
}

@PostMapping("/list")
@ResponseStatus(HttpStatus.CREATED)
fun uploadMultipleImage(files: List<MultipartFile>): UploadImageListWebResponse {
fun uploadMultipleImage(files: List<MultipartFile>): UploadImageListResponse {
return uploadImageUseCase.execute(
files.let(ImageFileConverter::transferToList)
).run(::UploadImageListWebResponse)
)
}

@PostMapping("/employee")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,20 @@ import org.springframework.web.bind.annotation.RequestMapping
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.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
import team.comit.simtong.domain.holiday.dto.request.AppointHolidayPeriodWebRequest
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.dto.request.AppointHolidayPeriodRequest
import team.comit.simtong.domain.holiday.dto.response.QueryEmployeeHolidayResponse
import team.comit.simtong.domain.holiday.dto.response.QueryIndividualHolidaysResponse
import team.comit.simtong.domain.holiday.dto.request.QueryIndividualRequest
import team.comit.simtong.domain.holiday.dto.response.QueryMonthHolidayPeriodResponse
import team.comit.simtong.domain.holiday.dto.response.QueryRemainAnnualResponse
import team.comit.simtong.domain.holiday.dto.AppointAnnualWebRequest
import team.comit.simtong.domain.holiday.dto.AppointHolidayPeriodWebRequest
import team.comit.simtong.domain.holiday.dto.AppointHolidayWebRequest
import team.comit.simtong.domain.holiday.dto.CancelHolidayWebRequest
import team.comit.simtong.domain.holiday.dto.ChangeEmployeeHolidayWebRequest
import team.comit.simtong.domain.holiday.dto.ShareHolidayWebRequest
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
Expand Down Expand Up @@ -67,9 +64,8 @@ class WebHolidayAdapter(
) {

@GetMapping("/annual/count")
fun queryRemainAnnual(@RequestParam year: Int): QueryRemainAnnualWebResponse {
fun queryRemainAnnual(@RequestParam year: Int): QueryRemainAnnualResponse {
return queryRemainAnnualUseCase.execute(year)
.run(::QueryRemainAnnualWebResponse)
}

@PostMapping("/annual")
Expand All @@ -94,21 +90,14 @@ class WebHolidayAdapter(
@RequestParam("start_at") startAt: LocalDate,
@RequestParam("end_at") endAt: LocalDate,
@RequestParam status: HolidayStatus
): QueryIndividualHolidaysWebResponse {
val result: List<Holiday> = queryIndividualHolidayUseCase.execute(
): QueryIndividualHolidaysResponse {
return queryIndividualHolidayUseCase.execute(
QueryIndividualRequest(
startAt = startAt,
endAt = endAt,
status = status
)
)

return result.map {
IndividualHolidayResponse(
date = it.date,
type = it.type
)
}.run(::QueryIndividualHolidaysWebResponse)
}

@PutMapping("/public")
Expand All @@ -131,26 +120,13 @@ class WebHolidayAdapter(
@RequestParam month: Int,
@RequestParam type: HolidayQueryType,
@RequestParam("team_id", required = false) teamId: UUID?
): QueryEmployeeHolidayWebResponse {
val result: List<EmployeeHoliday> = queryEmployeeHolidayUseCase.execute(
): QueryEmployeeHolidayResponse {
return 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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.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.dto.SaveMenuWebRequest
import team.comit.simtong.domain.menu.dto.request.SaveMenuRequest
import team.comit.simtong.domain.menu.dto.response.MenuResponse
import team.comit.simtong.domain.menu.usecase.QueryMenuByMonthUseCase
import team.comit.simtong.domain.menu.usecase.QueryPublicMenuUseCase
import team.comit.simtong.domain.menu.usecase.SaveMenuUseCase
Expand Down Expand Up @@ -39,30 +39,16 @@ class WebMenuAdapter(
fun getMenu(
@RequestParam("start_at") startAt: LocalDate,
@RequestParam("end_at") endAt: LocalDate
): MenuWebResponse {
): MenuResponse {
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
): MenuWebResponse {
): MenuResponse {
return queryPublicMenuUseCase.execute(startAt, endAt)
.map {
MenuWebResponse.MenuElement(
date = it.date,
meal = it.meal
)
}
.run(::MenuWebResponse)
}

@PostMapping("/{spot-id}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,16 @@ import org.springframework.web.bind.annotation.RequestMapping
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.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.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.dto.request.AddIndividualScheduleRequest
import team.comit.simtong.domain.schedule.dto.request.AddSpotScheduleRequest
import team.comit.simtong.domain.schedule.dto.request.ChangeIndividualScheduleRequest
import team.comit.simtong.domain.schedule.dto.request.ChangeSpotScheduleRequest
import team.comit.simtong.domain.schedule.dto.response.QueryEntireSpotScheduleResponse
import team.comit.simtong.domain.schedule.dto.response.QueryIndividualSpotScheduleResponse
import team.comit.simtong.domain.schedule.dto.AddIndividualScheduleWebRequest
import team.comit.simtong.domain.schedule.dto.AddSpotScheduleWebRequest
import team.comit.simtong.domain.schedule.dto.ChangeIndividualScheduleWebRequest
import team.comit.simtong.domain.schedule.dto.ChangeSpotScheduleWebRequest
import team.comit.simtong.domain.schedule.usecase.AddIndividualScheduleUseCase
import team.comit.simtong.domain.schedule.usecase.AddSpotScheduleUseCase
import team.comit.simtong.domain.schedule.usecase.ChangeIndividualScheduleUseCase
Expand Down Expand Up @@ -92,39 +88,16 @@ class WebScheduleAdapter(
fun queryIndividualSpotSchedule(
@RequestParam("start_at") startAt: LocalDate,
@RequestParam("end_at") endAt: LocalDate
): QueryIndividualSpotScheduleWebResponse {
val result: List<Schedule> = 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)
): QueryIndividualSpotScheduleResponse {
return queryIndividualSpotScheduleUseCase.execute(startAt, endAt)
}

@GetMapping("/spots")
fun queryEntireSpotSchedule(
@RequestParam("start_at") startAt: LocalDate,
@RequestParam("end_at") endAt: LocalDate
): QueryEntireSpotScheduleWebResponse {
val result: List<SpotSchedule> = 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)
): QueryEntireSpotScheduleResponse {
return queryEntireSpotScheduleUseCase.execute(startAt, endAt)
}

@PostMapping("/spots/{spot-id}")
Expand Down

0 comments on commit 95b3e04

Please sign in to comment.