Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/main/kotlin/com/moa/controller/AuthController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,15 @@ import com.moa.common.auth.Auth
import com.moa.common.auth.AuthMemberInfo
import com.moa.common.response.ApiResponse
import com.moa.service.AuthService
import com.moa.service.dto.AppleSignInUpRequest
import com.moa.service.dto.AppleSignInUpResponse
import com.moa.service.dto.KaKaoSignInUpRequest
import com.moa.service.dto.KakaoSignInUpResponse
import com.moa.service.dto.LogoutRequest
import com.moa.service.dto.*
import io.swagger.v3.oas.annotations.tags.Tag
import jakarta.validation.Valid
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RestController

@Tag(name = "Auth", description = "인증 API (카카오/애플 소셜 로그인)")
@Tag(name = "Auth", description = "인증 API")
@RestController
class AuthController(
private val authService: AuthService,
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/moa/controller/FcmTokenController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import io.swagger.v3.oas.annotations.tags.Tag
import jakarta.validation.Valid
import org.springframework.web.bind.annotation.*

@Tag(name = "fcm", description = "FCM TOKEN 갱신 및 삭제")
@Tag(name = "fcm", description = "Fcm Token 갱신 및 삭제")
@RestController
@RequestMapping("/api/v1/fcm/token")
class FcmTokenController(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.moa.service.notification.NotificationSettingService
import io.swagger.v3.oas.annotations.tags.Tag
import org.springframework.web.bind.annotation.*

@Tag(name = "NotificationSetting", description = "알림 설정 API (근무/급여일/프로모션 알림)")
@Tag(name = "NotificationSetting", description = "알림 설정 API")
@RestController
@RequestMapping("/api/v1/settings/notification")
class NotificationSettingController(
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/com/moa/controller/ProfileController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import com.moa.common.auth.AuthMemberInfo
import com.moa.common.response.ApiResponse
import com.moa.service.ProfileService
import com.moa.service.dto.NicknameUpdateRequest
import com.moa.service.dto.WorkplaceUpdateRequest
import com.moa.service.dto.PaydayUpdateRequest
import com.moa.service.dto.WorkplaceUpdateRequest
import io.swagger.v3.oas.annotations.tags.Tag
import jakarta.validation.Valid
import org.springframework.web.bind.annotation.*

@Tag(name = "Profile", description = "프로필 API (닉네임, 근무지, 급여일 등)")
@Tag(name = "Profile", description = "프로필 API")
@RestController
@RequestMapping("/api/v1/profile")
class ProfileController(
Expand Down
19 changes: 11 additions & 8 deletions src/main/kotlin/com/moa/controller/WorkdayController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,22 @@ import jakarta.validation.Valid
import org.springframework.web.bind.annotation.*
import java.time.LocalDate

@Tag(name = "Workday", description = "근무일/스케줄 API (출퇴근 일정 조회·등록·수정)")
@Tag(name = "Workday", description = "근무일/스케줄 API")
@RestController
@RequestMapping("/api/v1/workdays")
class WorkdayController(
private val workdayService: WorkdayService,
) {

@GetMapping("/{date}")
fun getSchedule(
@Auth member: AuthMemberInfo,
@PathVariable date: LocalDate,
) = ApiResponse.success(workdayService.getSchedule(member.id, date))

@Deprecated("Use GET /api/v1/calendar instead")
@GetMapping("/earnings")
fun getMonthlyEarnings(
@Auth member: AuthMemberInfo,
@RequestParam year: Int,
@RequestParam month: Int,
) = ApiResponse.success(workdayService.getMonthlyEarnings(member.id, year, month))

@Deprecated("Use GET /api/v1/calendar instead")
@GetMapping
fun getMonthlySchedules(
@Auth member: AuthMemberInfo,
Expand All @@ -39,7 +35,14 @@ class WorkdayController(
) = ApiResponse.success(
workdayService.getMonthlySchedules(member.id, year, month)
)


@Deprecated("Use GET /api/v1/calendar instead")
@GetMapping("/{date}")
fun getSchedule(
@Auth member: AuthMemberInfo,
@PathVariable date: LocalDate,
) = ApiResponse.success(workdayService.getSchedule(member.id, date))

@PutMapping("/{date}")
fun upsertSchedule(
@Auth member: AuthMemberInfo,
Expand Down
32 changes: 32 additions & 0 deletions src/main/kotlin/com/moa/controller/screen/CalendarController.kt
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),
)
)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.moa.controller
package com.moa.controller.screen

import com.moa.common.auth.Auth
import com.moa.common.auth.AuthMemberInfo
Expand Down Expand Up @@ -32,6 +32,7 @@ class HomeController(
standardSalary = earnings.standardSalary,
dailyPay = schedule.dailyPay,
type = schedule.type,
status = schedule.status,
clockInTime = schedule.clockInTime,
clockOutTime = schedule.clockOutTime,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.moa.controller
package com.moa.controller.screen

import com.moa.common.auth.AuthMemberInfo
import com.moa.common.auth.OnboardingAuth
Expand All @@ -12,7 +12,7 @@ import io.swagger.v3.oas.annotations.tags.Tag
import jakarta.validation.Valid
import org.springframework.web.bind.annotation.*

@Tag(name = "Onboarding", description = "온보딩 API (최초 가입 시 프로필/급여/근무정책/약관 설정)")
@Tag(name = "Onboarding", description = "온보딩 화면 API")
@RestController
@RequestMapping("/api/v1/onboarding")
class OnboardingController(
Expand Down
6 changes: 6 additions & 0 deletions src/main/kotlin/com/moa/entity/DailyEventType.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.moa.entity

enum class DailyEventType {
PAYDAY,
HOLIDAY,
}
7 changes: 7 additions & 0 deletions src/main/kotlin/com/moa/entity/DailyWorkStatusType.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.moa.entity

enum class DailyWorkStatusType {
NONE,
SCHEDULED,
COMPLETED,
}
17 changes: 17 additions & 0 deletions src/main/kotlin/com/moa/service/PaydayResolver.kt
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
}
}
Loading
Loading