-
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 pull request #28 from Nexters/feature/27-update-resort-dates-an…
…d-status [#27] 스키장 개장일/폐장일 업데이트 API 추가 및 운영 상태 업데이트 Batch 추가 및 조회 필드 추가
- Loading branch information
Showing
10 changed files
with
216 additions
and
7 deletions.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
src/main/kotlin/nexters/weski/batch/ResortBatchController.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,71 @@ | ||
package nexters.weski.batch | ||
|
||
import io.swagger.v3.oas.annotations.Operation | ||
import io.swagger.v3.oas.annotations.media.Content | ||
import io.swagger.v3.oas.annotations.media.Schema | ||
import io.swagger.v3.oas.annotations.tags.Tag | ||
import nexters.weski.ski_resort.SkiResortService | ||
import org.springframework.web.bind.annotation.PostMapping | ||
import org.springframework.web.bind.annotation.RequestBody | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
|
||
@Tag(name = "스키장 개장일/폐장일 업데이트 API", description = "스키장 개장일/폐장일을 업데이트") | ||
@RestController | ||
class ResortBatchController( | ||
private val resortService: SkiResortService | ||
) { | ||
@Operation( | ||
summary = "스키장 개장일/폐장일 업데이트 API", | ||
description = """ | ||
스키장 개장일을 업데이트하면 해당 스키장의 개장일이 변경됩니다. | ||
date : OPENING_DATE, CLOSING_DATE 중 하나를 선택합니다. | ||
resortId는 다음과 같습니다. | ||
1, 지산 리조트 | ||
2, 곤지암 스키장 | ||
3, 비발디파크 | ||
4, 엘리시안 강촌 | ||
5, 웰리힐리파크 | ||
6, 휘닉스파크 | ||
7, 하이원 스키장 | ||
8, 용평스키장 모나 | ||
9, 무주덕유산 | ||
10, 에덴벨리(양산) | ||
11, 오투리조트 | ||
""" | ||
) | ||
@PostMapping("/batch/resort-date") | ||
fun updateResortDate( | ||
@RequestBody | ||
@io.swagger.v3.oas.annotations.parameters.RequestBody( | ||
description = "스키장 개장일/폐장일 업데이트 요청", | ||
required = true, | ||
content = [Content( | ||
mediaType = "application/json", | ||
schema = Schema(implementation = ResortDateUpdateRequest::class) | ||
)] | ||
) | ||
request: ResortDateUpdateRequest | ||
) { | ||
resortService.updateResortDate( | ||
resortId = request.resortId, | ||
dateType = request.dateType, | ||
date = request.date | ||
) | ||
} | ||
|
||
@Operation( | ||
summary = "스키장 운영상태 업데이트", | ||
description = """ | ||
스키장 운영상태를 업데이트하면 해당 스키장의 개장일과 폐장일을 기준으로 운영상태가 변경됩니다. | ||
스키장 운영상태는 다음과 같습니다. | ||
- 예정 | ||
- 운영중 | ||
- 운영종료 | ||
""" | ||
) | ||
@PostMapping("/batch/resort-status") | ||
fun updateResortStatus() { | ||
resortService.updateSkiResortStatus() | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/kotlin/nexters/weski/batch/ResortDateUpdateRequest.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,32 @@ | ||
package nexters.weski.batch | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema | ||
import java.time.LocalDate | ||
|
||
class ResortDateUpdateRequest ( | ||
@Schema( | ||
description = "스키장 ID", | ||
example = "1" | ||
) | ||
val resortId: Long, | ||
|
||
@Schema( | ||
description = "날짜 타입 (OPENING_DATE: 개장일, CLOSING_DATE: 폐장일)", | ||
example = "OPENING_DATE" | ||
) | ||
val dateType: DateType, | ||
|
||
@Schema( | ||
description = "날짜 (yyyy-MM-dd 형식)", | ||
example = "2024-11-30" | ||
) | ||
val date: LocalDate | ||
) | ||
|
||
enum class DateType { | ||
@Schema(description = "개장일") | ||
OPENING_DATE, | ||
|
||
@Schema(description = "폐장일") | ||
CLOSING_DATE | ||
} |
15 changes: 15 additions & 0 deletions
15
src/main/kotlin/nexters/weski/batch/ResortStatusUpdateScheduler.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,15 @@ | ||
package nexters.weski.batch | ||
|
||
import nexters.weski.ski_resort.SkiResortService | ||
import org.springframework.scheduling.annotation.Scheduled | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
class ResortStatusUpdateScheduler( | ||
private val skiResortService: SkiResortService | ||
) { | ||
@Scheduled(cron = "15 0 0 * * ?") | ||
fun scheduleResortStatusUpdate() { | ||
skiResortService.updateSkiResortStatus() | ||
} | ||
} |
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
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