-
Notifications
You must be signed in to change notification settings - Fork 0
Add new calendar API endpoint #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
bb79e12
Add CalendarController and refactor WorkdayService for calendar retri…
jeyongsong dfe39fc
Add status resolution in WorkdayService
jeyongsong a0ba02f
Add calendar event resolution for payday in WorkdayService
jeyongsong 86b9375
Refactor earnings calculation to adjust clock-out time based on curre…
jeyongsong 9fe5819
Refactor controller tag descriptions for clarity
jeyongsong 7f78920
Refactor CalendarController and WorkdayService for monthly calendar r…
jeyongsong 372cde6
Refactor DailWorkStatusType and WorkdayService for status resolution …
jeyongsong f1fedb6
Refactor WorkdayService to improve earnings calculation logic for com…
jeyongsong 4302786
Refactor DailWorkStatusType and CalendarEventType to DailyWorkStatusT…
jeyongsong 80882fc
Refactor PaydayNotificationBatchService and WorkdayService for improv…
jeyongsong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
32 changes: 32 additions & 0 deletions
32
src/main/kotlin/com/moa/controller/screen/CalendarController.kt
This file contains hidden or 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 com.moa.controller.screen | ||
|
|
||
| import com.moa.common.auth.Auth | ||
| import com.moa.common.auth.AuthMemberInfo | ||
| import com.moa.common.response.ApiResponse | ||
| import com.moa.service.WorkdayService | ||
| import com.moa.service.dto.CalendarResponse | ||
| import io.swagger.v3.oas.annotations.tags.Tag | ||
| 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 | ||
|
|
||
| @Tag(name = "Calendar", description = "캘린더 화면 API") | ||
| @RestController | ||
| @RequestMapping("/api/v1/calendar") | ||
| class CalendarController( | ||
| private val workdayService: WorkdayService, | ||
| ) { | ||
|
|
||
| @GetMapping | ||
| fun getCalendar( | ||
| @Auth member: AuthMemberInfo, | ||
| @RequestParam year: Int, | ||
| @RequestParam month: Int, | ||
| ) = ApiResponse.success( | ||
| CalendarResponse( | ||
| earnings = workdayService.getMonthlyEarnings(member.id, year, month), | ||
| schedules = workdayService.getMonthlyWorkdays(member.id, year, month), | ||
| ) | ||
| ) | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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,6 @@ | ||
| package com.moa.entity | ||
|
|
||
| enum class DailyEventType { | ||
| PAYDAY, | ||
| HOLIDAY, | ||
| } |
This file contains hidden or 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,7 @@ | ||
| package com.moa.entity | ||
|
|
||
| enum class DailyWorkStatusType { | ||
| NONE, | ||
| SCHEDULED, | ||
| COMPLETED, | ||
| } | ||
This file contains hidden or 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,17 @@ | ||
| package com.moa.service | ||
|
|
||
| import java.time.DayOfWeek | ||
| import java.time.LocalDate | ||
| import java.time.YearMonth | ||
|
|
||
| // 월급일이 해당 월에 없으면 말일로 보정하고, 그 날짜가 주말이면 직전 금요일로 당긴다. | ||
| fun resolveEffectivePayday(year: Int, month: Int, paydayDay: Int): LocalDate { | ||
| val yearMonth = YearMonth.of(year, month) | ||
| val baseDate = yearMonth.atDay(minOf(paydayDay, yearMonth.lengthOfMonth())) | ||
|
|
||
| return when (baseDate.dayOfWeek) { | ||
| DayOfWeek.SATURDAY -> baseDate.minusDays(1) | ||
| DayOfWeek.SUNDAY -> baseDate.minusDays(2) | ||
| else -> baseDate | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.