Skip to content

Add DailyWorkSchedule entity and Workday service with CRU operations#12

Merged
subsub97 merged 4 commits intomainfrom
overwork
Feb 13, 2026
Merged

Add DailyWorkSchedule entity and Workday service with CRU operations#12
subsub97 merged 4 commits intomainfrom
overwork

Conversation

@subsub97
Copy link
Collaborator

@subsub97 subsub97 commented Feb 9, 2026

This pull request introduces a new feature for managing daily work schedules, including entity creation, data access, service logic, and API endpoints. The changes allow users to retrieve, update, and patch their workday schedules, with proper validation and error handling.

Workday schedule management feature:

  • Added the DailyWorkSchedule entity to represent daily work schedules, enforcing uniqueness for each member and date (src/main/kotlin/com/moa/entity/DailyWorkSchedule.kt).
  • Created the DailyWorkScheduleRepository for accessing daily work schedules by member and date (src/main/kotlin/com/moa/repository/DailyWorkScheduleRepository.kt).
  • Implemented the WorkdayService with methods for retrieving, upserting, and patching workday schedules, including validation and fallback to work policy defaults if no schedule exists (src/main/kotlin/com/moa/service/WorkdayService.kt).

API and DTO additions:

  • Added WorkdayController with endpoints for getting, upserting, and patching daily work schedules (src/main/kotlin/com/moa/controller/WorkdayController.kt).
  • Introduced DTOs for request and response handling: WorkdayEditRequest, WorkdayUpsertRequest, and WorkdayResponse (src/main/kotlin/com/moa/service/dto/WorkdayEditRequest.kt, src/main/kotlin/com/moa/service/dto/WorkdayUpsertRequest.kt, src/main/kotlin/com/moa/service/dto/WorkdayResponse.kt). [1] [2] [3]

Error handling improvements:

  • Added a new error code WORKDAY_NOT_FOUND for cases where a workday schedule cannot be found (src/main/kotlin/com/moa/common/exception/ErrorCode.kt).

@github-actions
Copy link

github-actions bot commented Feb 9, 2026

Test Results

8 tests   8 ✅  0s ⏱️
1 suites  0 💤
1 files    0 ❌

Results for commit 42339cd.

♻️ This comment has been updated with latest results.

Copy link
Member

@jeyongsong jeyongsong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

구우웃

Comment on lines +25 to +37
@PutMapping("/{date}")
fun upsertSchedule(
@Auth member: AuthMemberInfo,
@PathVariable date: LocalDate,
@RequestBody @Valid req: WorkdayUpsertRequest,
) = ApiResponse.success(workdayService.upsertSchedule(member.id, date, req))

@PatchMapping("/{date}")
fun patchClockOut(
@Auth member: AuthMemberInfo,
@PathVariable date: LocalDate,
@RequestBody @Valid req: WorkdayEditRequest,
) = ApiResponse.success(workdayService.patchClockOut(member.id, date, req))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

생각해보니 수정된 퇴근시간이 다음날을 넘기면 우짜지

이거 시작시간보다 끝시간이 이전이면 다음날으로 쳐야하나?

Comment on lines +25 to +41
fun getSchedule(memberId: Long, date: LocalDate): WorkdayResponse {
val workSchedule = dailyWorkScheduleRepository.findByMemberIdAndDate(memberId, date)
if (workSchedule != null) {
return WorkdayResponse(
date = date,
clockInTime = workSchedule.clockInTime,
clockOutTime = workSchedule.clockOutTime,
)
}

val policy = findEffectivePolicyForWorkday(memberId, date)

return WorkdayResponse(
date = date,
clockInTime = policy.clockInTime,
clockOutTime = policy.clockOutTime,
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 해당 날짜에 출퇴근 기록 있으면 반환이고 없으면 정책에서 가져오는거지??

나랑 생각이 같아 구우웃

@subsub97 subsub97 merged commit b0b5f7a into main Feb 13, 2026
2 checks passed
@subsub97 subsub97 deleted the overwork branch February 13, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants