Skip to content

[Fix/#596] 마감일 지난 과제에 세부과제 등록/수정 시 예외처리 추가 - #597

Merged
songwol38 merged 3 commits into
developfrom
fix/issue-596
Aug 8, 2026
Merged

songwol38 merged 3 commits into
developfrom
fix/issue-596

Conversation

@jeongkyueun

@jeongkyueun jeongkyueun commented Jul 31, 2026 •

Copy link
Copy Markdown
Collaborator

📌 [Fix/#596] 마감일 지난 과제에 세부과제 등록/수정 시 예외처리 추가

📌 관련 이슈번호

📌 PR 유형

어떤 변경 사항이 있나요?

  • 새 기능 추가
  • 버그 수정
  • 리팩토링

📌 PR 요약

fix: D-Day 계산 시 서버 타임존에 따라 날짜가 밀리는 버그 수정

계산에 사용되던 로컬 getter가 서버 프로세스의 타임존에 의존해
KST 자정 전후 UTC 배포 환경에서 하루씩 밀리는 문제가 있었음.
formatDate와 동일하게 UTC+9 오프셋을 명시적으로 적용하도록 수정.

fix: 마감일 지난 과제에 세부과제 등록/수정 시 예외처리 추가

세부과제 단건 생성에는 부모 과제 마감일 초과 검증이 있었지만
일괄 수정 API에는 빠져있어 우회 가능했던 문제를 수정.
부모 마감일이 이미 지난 경우 TASK_DEADLINE_EXPIRED 에러 코드로
구분해 반환하도록 해서 프론트에서 전용 모달을 띄울 수 있게 함.

📌 작업 세부 내용

변경 사항

1. D-Day 계산 버그 수정

  • calculateDDay가 서버 프로세스 타임존에 의존하는 로컬 getter를 사용하고 있어,
    배포 서버가 UTC 타임존이면 KST 자정 전후 9시간 구간에서 D-Day가 하루씩
    틀리게 나오는 문제가 있었습니다.
  • 같은 파일의 formatDate처럼 UTC+9 오프셋을 명시적으로 더한 뒤 UTC getter로
    날짜만 추출하도록 통일해, 서버 타임존과 무관하게 항상 정확한 KST 기준으로
    계산되도록 수정했습니다.

2. 마감일 지난 과제에 세부과제 등록 시 예외처리

  • 세부과제 단건 생성(POST /task/:taskId/subtask)에는 "부모 과제 마감일 초과 불가"
    검증이 있었지만, 일괄 수정(PATCH /task/:taskId/subtask)에는 이 검증이 빠져있어
    마감일이 지난 과제에도 세부과제 날짜를 수정할 수 있는 구멍이 있었습니다.
  • 단건 생성 / 단건 수정 / 일괄 수정 세 경로 모두 검증을 통일하고, 부모 과제의
    마감일이 이미 지난 경우 TASK_DEADLINE_EXPIRED 에러 코드로 구분해 반환하도록
    했습니다. 프론트에서 해당 코드로 분기해 안내 모달을 띄우면 됩니다.

테스트

  • npx vitest run 전체 통과 (기존에 실패하던 무관한 테스트 35건 제외, 회귀 없음 확인)
  • 로컬 서버 기동 확인, D-Day/예외처리 시나리오 수동 확인

📸 스크린샷 (선택)

🔗 참고 자료

Summary by CodeRabbit

변경 사항

  • 버그 수정

    • 시간대에 관계없이 마감일까지 남은 일수가 정확하게 계산됩니다.
    • 부모 작업의 마감일이 지난 경우 세부 작업에 만료 오류가 표시됩니다.
    • 활성 부모 작업의 마감일을 초과한 경우 기존 검증 오류가 유지됩니다.
  • 문서

    • 세부 작업 생성·수정 및 마감일 변경 API의 오류 응답 예시를 업데이트했습니다.
    • 세부 작업 생성 API 경로 문서를 정리했습니다.

@jeongkyueun jeongkyueun self-assigned this Jul 31, 2026
@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

KST 날짜 계산을 결정적으로 변경합니다. 세부 태스크의 부모 마감일이 만료되면 TASK_DEADLINE_EXPIRED를 반환합니다. 활성 부모 마감일을 초과하면 INVALID_DEADLINE을 반환합니다. Swagger 문서도 갱신합니다.

Changes

태스크 마감일 처리

Layer / File(s) Summary
결정적 KST 날짜 계산
src/dtos/task.dto.js
calculateDDay가 UTC 기반 방식으로 KST 날짜를 계산합니다. 기존 추가 날짜 보정을 제거합니다.
세부 태스크 부모 마감일 검증
src/services/task.service.js, tests/unit/subtask-enddate-nullable.test.js
세부 태스크 생성과 수정에서 만료된 부모 마감일과 활성 부모 마감일 초과를 서로 다른 오류 코드로 처리합니다. 테스트 픽스처의 부모 마감일을 2026년 12월 31일로 변경합니다.
마감일 오류 문서
src/swagger/swagger.yml
세부 태스크 생성과 수정 API에 TASK_DEADLINE_EXPIRED 및 INVALID_DEADLINE 응답을 추가합니다. 기존 단일 생성 경로 문서를 제거합니다.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: jungmini-developer, yangwooyoung123

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 마감된 부모 과제의 세부과제 등록·수정 예외처리라는 주요 변경을 정확히 설명합니다.
Linked Issues check ✅ Passed 세부 이슈 #596의 목적에 맞게 마감된 부모 과제의 세부과제 생성·수정 검증과 TASK_DEADLINE_EXPIRED 처리를 구현했습니다.
Out of Scope Changes check ✅ Passed D-Day 수정, Swagger 변경, 테스트 fixture 변경은 PR 목표를 지원하며 제공된 범위를 벗어난 변경이 없습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-596

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 oasdiff (1.27.0)
src/swagger/swagger.yml

Error: failed to load base spec from "/tmp/coderabbit-oasdiff-base.a7RdmK": failed to unmarshal data: json error: invalid character 'o' looking for beginning of value, yaml error: error converting YAML to JSON: yaml: unmarshal errors:
line 2389: mapping key "/api/v1/task/{taskId}/member/{userId}" already defined at line 2301


Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/services/task.service.js`:
- Around line 612-621: Replace both plain Error instances in the task deadline
validation path with BadRequestError, preserving their existing messages and
errorCode values (TASK_DEADLINE_EXPIRED and INVALID_DEADLINE). Ensure both
thrown errors provide the required reason through the BadRequestError contract
while retaining status code 400.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a205a564-a663-49c1-915f-4c6bb482c8ff

📥 Commits

Reviewing files that changed from the base of the PR and between 5524506 and 4e94127.

📒 Files selected for processing (3)
  • src/dtos/task.dto.js
  • src/services/task.service.js
  • tests/unit/subtask-enddate-nullable.test.js

Comment thread src/services/task.service.js Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/swagger/swagger.yml`:
- Around line 2261-2268: Update the Swagger documentation for the registered
lowercase POST /api/v1/task/{taskId}/subtask path to include both
INVALID_DEADLINE and TASK_DEADLINE_EXPIRED response examples, and remove the
obsolete uppercase subtask path documentation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1e5eaafd-3046-49c9-ac51-e6d42808d5e6

📥 Commits

Reviewing files that changed from the base of the PR and between 4e94127 and 06646a6.

📒 Files selected for processing (1)
  • src/swagger/swagger.yml

Comment thread src/swagger/swagger.yml Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/swagger/swagger.yml (1)

2965-2971: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

TASK_DEADLINE_EXPIRED 사유를 모든 수정 동작에 맞게 수정하세요.

이 PATCH 요청은 title, deadline, isAlarm을 수정할 수 있습니다. PR 목표는 만료된 부모 과제의 세부 과제 수정을 거부합니다. 그러나 Line 2971은 deadline 변경만 불가한 것으로 설명합니다. 세부 과제 전체를 수정할 수 없다고 문서화하세요.

수정 제안
-                    reason: "이미 마감일이 지난 과제의 세부 과제 마감일은 변경할 수 없습니다."
+                    reason: "이미 마감일이 지난 과제의 세부 과제는 수정할 수 없습니다."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/swagger/swagger.yml` around lines 2965 - 2971, Update the
TASK_DEADLINE_EXPIRED reason in the task_deadline_expired Swagger response to
state that modifying any subtask field is prohibited when the parent task
deadline has expired, covering title, deadline, and isAlarm rather than only
deadline changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/swagger/swagger.yml`:
- Around line 2965-2971: Update the TASK_DEADLINE_EXPIRED reason in the
task_deadline_expired Swagger response to state that modifying any subtask field
is prohibited when the parent task deadline has expired, covering title,
deadline, and isAlarm rather than only deadline changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 770aded6-ec28-4dd6-828a-9663018c4897

📥 Commits

Reviewing files that changed from the base of the PR and between 06646a6 and d41d52e.

📒 Files selected for processing (2)
  • src/services/task.service.js
  • src/swagger/swagger.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/services/task.service.js

@songwol38
songwol38 merged commit 81f459b into develop Aug 8, 2026
3 checks passed
@songwol38
songwol38 deleted the fix/issue-596 branch August 8, 2026 18:56
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.

[Fix] 마감일 지난 과제에 세부과제 등록/수정 시 예외처리 추가

2 participants