|
| 1 | +package devkor.com.teamcback.domain.operatingtime.controller; |
| 2 | + |
| 3 | +import devkor.com.teamcback.domain.operatingtime.dto.request.SavePlaceOperatingTimeConditionReq; |
| 4 | +import devkor.com.teamcback.domain.operatingtime.dto.request.SavePlaceOperatingTimeReq; |
| 5 | +import devkor.com.teamcback.domain.operatingtime.dto.response.GetPlaceOperatingTimeRes; |
| 6 | +import devkor.com.teamcback.domain.operatingtime.dto.response.SavePlaceOperatingTimeConditionRes; |
| 7 | +import devkor.com.teamcback.domain.operatingtime.dto.response.SavePlaceOperatingTimeRes; |
| 8 | +import devkor.com.teamcback.domain.operatingtime.service.AdminOperatingTimeService; |
| 9 | +import devkor.com.teamcback.global.response.CommonResponse; |
| 10 | +import io.swagger.v3.oas.annotations.Operation; |
| 11 | +import io.swagger.v3.oas.annotations.Parameter; |
| 12 | +import io.swagger.v3.oas.annotations.media.Content; |
| 13 | +import io.swagger.v3.oas.annotations.media.Schema; |
| 14 | +import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| 15 | +import io.swagger.v3.oas.annotations.responses.ApiResponses; |
| 16 | +import jakarta.validation.Valid; |
| 17 | +import lombok.RequiredArgsConstructor; |
| 18 | +import org.springframework.web.bind.annotation.*; |
| 19 | + |
| 20 | +@RestController |
| 21 | +@RequiredArgsConstructor |
| 22 | +@RequestMapping("/api/admin/operating-time") |
| 23 | +public class AdminOperatingTimeController { |
| 24 | + private final AdminOperatingTimeService adminOperatingTimeService; |
| 25 | + |
| 26 | + @GetMapping("/places/{placeId}") |
| 27 | + @Operation(summary = "장소의 운영시간 검색", |
| 28 | + description = "장소 id로 운영시간 검색") |
| 29 | + @ApiResponses(value = { |
| 30 | + @ApiResponse(responseCode = "200", description = "정상 처리 되었습니다."), |
| 31 | + @ApiResponse(responseCode = "404", description = "장소를 찾을 수 없습니다.", |
| 32 | + content = @Content(schema = @Schema(implementation = CommonResponse.class))), |
| 33 | + }) |
| 34 | + public CommonResponse<GetPlaceOperatingTimeRes> getPlaceOperatingTime( |
| 35 | + @Parameter(name = "placeId", description = "장소 ID") @PathVariable Long placeId) { |
| 36 | + return CommonResponse.success(adminOperatingTimeService.getPlaceOperatingTime(placeId)); |
| 37 | + } |
| 38 | + |
| 39 | + @PutMapping("/places/{placeId}") |
| 40 | + @Operation(summary = "장소의 운영시간 저장", |
| 41 | + description = "장소가 각 요일별로 고정된 운영시간을 가지는 경우(00:00-00:00 형식 포함)") |
| 42 | + @ApiResponses(value = { |
| 43 | + @ApiResponse(responseCode = "200", description = "정상 처리 되었습니다."), |
| 44 | + @ApiResponse(responseCode = "404", description = "장소를 찾을 수 없습니다.", |
| 45 | + content = @Content(schema = @Schema(implementation = CommonResponse.class))), |
| 46 | + }) |
| 47 | + public CommonResponse<SavePlaceOperatingTimeRes> savePlaceOperatingTime( |
| 48 | + @Parameter(name = "placeId", description = "장소 ID") @PathVariable Long placeId, |
| 49 | + @Parameter(description = "요일별 운영 시간") @RequestBody SavePlaceOperatingTimeReq req) { |
| 50 | + return CommonResponse.success(adminOperatingTimeService.savePlaceOperatingTime(placeId, req)); |
| 51 | + } |
| 52 | + |
| 53 | + @PostMapping("/places/{placeId}") |
| 54 | + @Operation(summary = "장소의 조건 및 운영시간 저장(별도로 요일별 대표 운영 시간도 저장해야 함)", |
| 55 | + description = "장소가 조건에 따라 유동적인 운영시간을 가지는 경우") |
| 56 | + @ApiResponses(value = { |
| 57 | + @ApiResponse(responseCode = "200", description = "정상 처리 되었습니다."), |
| 58 | + @ApiResponse(responseCode = "404", description = "장소를 찾을 수 없습니다.", |
| 59 | + content = @Content(schema = @Schema(implementation = CommonResponse.class))), |
| 60 | + }) |
| 61 | + public CommonResponse<SavePlaceOperatingTimeConditionRes> savePlaceOperatingTimeCondition( |
| 62 | + @Parameter(name = "placeId", description = "장소 ID") @PathVariable Long placeId, |
| 63 | + @Parameter(description = "조건 및 운영 시간") @RequestBody @Valid SavePlaceOperatingTimeConditionReq req) { |
| 64 | + return CommonResponse.success(adminOperatingTimeService.savePlaceOperatingTimeCondition(placeId, req)); |
| 65 | + } |
| 66 | +} |
0 commit comments