[fix] 급여명세서 계산 정확도 개선 및 Worker API null 안전성 보완#179
Merged
Conversation
- Add null safety checks for User object in WorkerDto.Response.from() - Add null safety checks for Worker/User objects in ContractDto - Update API_SPECIFICATION.md with profileImageUrl field - Fixes review feedback for fix/154-worker-kakao-info
…e premiums and preventing double counting
Walkthrough근로자 프로필 이미지 필드를 추가하고, 일일 초과근무와 주간 초과근무를 분리하여 계산하도록 급여 산출 로직을 재구성했습니다. 데이터 접근 최적화와 API 명세 업데이트를 포함합니다. Changes초과근무 계산 및 급여 항목 분리
프로필 이미지 필드 및 데이터 조회 최적화
Estimated code review effort🎯 4 (Complex) | ⏱️ ~65 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- Fix regularHours bug in WorkRecord: use totalHours - nightHours (not totalHours) - Add missing getOvertimeSalary()/getOvertimeHours() mock stubs to prevent NPE - Update test assertions to match new salary decomposition: basePay = totalHours × rate × 1.0, premiums = hours × rate × 0.5 - Update WeeklyAllowance overtime assertions: 1.5x rate → 0.5x rate Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🔖 관련 GitHub Issue
📝 변경 사항
주요 변경 내용
profileImageUrl필드 추가 및 null 안전성 개선 (NPE 방지)WorkerContractRepository쿼리에JOIN FETCH w.user추가로 N+1 문제 해결WeeklyAllowance주간 연장수당 계산 시 이미 일일 연장으로 처리된 시간 차감상세 설명
1. 급여 계산 정확도 개선 (이슈 #154 핵심)
기존에는 일 8시간 초과분이
WorkRecord레벨에서 연장수당으로 계산된 후,WeeklyAllowance에서 주간 40시간 초과분을 계산할 때 같은 시간이 다시 포함되어 이중 계산이 발생했습니다.WorkRecord에overtimeHours,overtimeSalary필드 추가 (일일 8시간 초과분 명시)WorkRecord.calculateSalaryWithAllowanceRules()를 단순화: 기본급(1.0배) + 야간/휴일/연장 가산분(0.5배)으로 통일WeeklyAllowance에서 주간 연장 계산 시totalDailyOvertimeHours를 차감한 순수 주간 초과분에만 0.5배 적용SalaryService에서totalDailyOvertimePay와totalWeeklyOvertimePay분리 집계2. Worker API null 안전성 개선
contract.getWorker().getUser().getName()방식 접근 시 User 탈퇴/null인 경우 NPE 발생 가능성 제거.ContractDto.Response,ContractDto.ListResponse,WorkerDto.Response의from()메서드에 null 체크 추가.3. N+1 쿼리 해결
WorkerContractRepository의 4개 조회 쿼리 모두에JOIN FETCH w.user u추가하여 Worker → User 접근 시 추가 쿼리 방지.4. Refresh Token HttpOnly Cookie 전환
기존 응답 Body로 전달되던 Refresh Token을 HttpOnly Cookie로 변경. XSS 공격을 통한 토큰 탈취 위험 차단.
5. AWS S3 프로필 이미지 업로드 제거
ProfileImageStorageService,S3Config,FileUploadException및 관련 엔드포인트 제거.📸 스크린샷 (선택사항)
스크린샷 보기
Before
After
✅ 체크리스트
🔗 관련 PR
Summary by CodeRabbit
릴리스 노트
새로운 기능
profileImageUrl필드 추가개선 사항