Skip to content

[FEAT] 캘린더 통합조회 GET /api/calendar 구현 - #247

Merged
mosungjin merged 2 commits into
developfrom
feat/mnppi-calendar-view
Aug 9, 2026
Merged

[FEAT] 캘린더 통합조회 GET /api/calendar 구현#247
mosungjin merged 2 commits into
developfrom
feat/mnppi-calendar-view

Conversation

@MNPPI223

@MNPPI223 MNPPI223 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

📌 연관 이슈


📝 작업 내용

  • GET /api/calendar?month=yyyy-MM 신규 — 역할별 단일 통합 엔드포인트
  • OWNER: 본인이 만든 프로젝트 기간(createdAt~dueDate)이 요청 월과 겹치는 것만 반환
  • LEADER/MEMBER: 본인 PERSONAL 액션 마감일 + 개인 Todo를 합쳐서 반환(TEAM 액션 제외)
  • ProjectRepositoryfindAllByCompanyIdAndCreatedBy 신규(OWNER 화면 전용)

🖥️ 프론트엔드 연동 가이드 (API 명세)

1. 주요 엔드포인트

  • GET /api/calendar?month=yyyy-MM : 역할별 캘린더 통합 조회 (month 생략 시 이번 달)

2. 요청 파라미터 (Request)

파라미터명 위치 필수 여부 설명
month Query 선택 yyyy-MM 형식, 생략 시 서버 기준 이번 달

3. 정상 응답 예시 (200 OK)

응답 JSON 보기 (클릭)
{
  "httpStatus": 200,
  "message": "캘린더를 조회했습니다.",
  "data": [
    {
      "type": "PROJECT",
      "title": "프로젝트명",
      "tag": "TAG-1",
      "startDate": "2026-08-01",
      "endDate": "2026-08-20"
    },
    {
      "type": "ACTION",
      "title": "액션 제목",
      "tag": null,
      "startDate": "2026-08-15",
      "endDate": "2026-08-15"
    },
    {
      "type": "TODO",
      "title": "Todo 내용",
      "tag": null,
      "startDate": "2026-08-20",
      "endDate": "2026-08-20"
    }
  ]
}

4. ⚠️ 프론트엔드 참고 및 주의사항

  • type에 따라 응답 항목이 배타적입니다 — OWNER 로그인 시 PROJECT만, LEADER/MEMBER 로그인 시 ACTION·TODO만 섞여서 나옵니다.
  • ACTION·TODO처럼 단일 날짜인 항목은 startDate == endDate입니다. PROJECT만 기간(span)입니다.
  • tag는 PROJECT에만 값이 있고, ACTION·TODO는 항상 null입니다.
  • Project에 아직 진짜 startDate 필드가 없어 createdAt(생성일)을 임시 시작점으로 씁니다 — 프로젝트 생성일과 실제 착수일이 다르면 간트 시작점이 부정확할 수 있습니다.

🚨 주요 에러 코드 및 예외 (Exceptions)

  • 별도 신규 에러 코드 없음 — 인증 안 된 요청은 기존 401 처리 그대로.

💡 백엔드 리뷰 포인트 (Backend Review)

  • 아키텍처 및 도메인: calendar가 project·action 도메인 Repository를 ACL 포트 없이 직접 주입. project·action·calendar 모두 동일 담당자(BE PL) 소유 도메인이라는 전제로 결정했습니다(다른 담당자 소유 도메인과의 크로스 BC 조회에 쓰는 ProjectQueryPort 패턴과는 의도적으로 다른 선택).
  • 우려되는 부분이나 고민:
    • ActionRepository.findAllByAssigneeMemberId가 companyId로 스코프되지 않아 서비스 레이어에서 방어적으로 companyId 필터를 추가로 걸었습니다. 이게 맞는 방어 위치인지 의견 부탁드립니다.
    • Project.startDate 부재로 createdAt을 임시 대체값으로 쓴 점 — 진짜 필드 추가(마이그레이션) 필요 여부는 이슈 #246에 후속 논의로 남겨뒀습니다.

✅ 체크리스트

  • 코드 컨벤션을 준수했습니다.
  • 불필요한 주석 및 콘솔 로그를 제거했습니다.
  • API 기능이 정상 동작하는지 테스트했습니다.
  • 예외(잘못된 값) 상황에 대한 검증 및 테스트를 통과했습니다.

Summary by CodeRabbit

  • 새 기능

    • 프로젝트, 액션, Todo를 한곳에서 확인할 수 있는 통합 캘린더 조회 기능을 추가했습니다.
    • 원하는 월을 지정해 조회할 수 있으며, 미지정 시 현재 월을 표시합니다.
    • 권한에 따라 프로젝트 또는 개인 일정이 조회됩니다.
    • 일정 유형, 제목, 태그, 시작일과 종료일을 제공합니다.
  • 테스트

    • 월별 일정 필터링, 권한별 조회, API 응답 동작을 검증하는 테스트를 추가했습니다.

OWNER: 본인이 만든 프로젝트 기간(createdAt~dueDate, 요청 월과 겹치는 것만)
LEADER/MEMBER: 본인 PERSONAL 액션 마감일 + 개인 Todo 통합 반환(TEAM 액션 제외)

Project에 startDate 필드가 없어 createdAt을 임시 시작점으로 사용(진짜 필드
추가는 공용 테이블 마이그레이션이라 스코프 밖으로 결정). project·action·
calendar 모두 동일 담당자 소유라 ACL 포트 없이 도메인 Repository를 직접
조합.
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@MNPPI223, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 38 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e30f5214-761b-4811-9727-0adf599d6690

📥 Commits

Reviewing files that changed from the base of the PR and between ed95660 and 5a4b283.

📒 Files selected for processing (2)
  • src/main/java/com/module06/backend/calendar/presentation/api/CalendarController.java
  • src/main/java/com/module06/backend/calendar/presentation/api/TodoController.java
📝 Walkthrough

Walkthrough

GET /api/calendar 통합 조회 기능을 추가했다. OWNER는 본인 프로젝트를 조회하고, LEADER/MEMBER는 개인 액션과 Todo를 조회한다. 조회 결과는 공통 CalendarItem 응답으로 반환한다.

Changes

통합 캘린더 조회

Layer / File(s) Summary
캘린더 응답 계약
src/main/java/com/module06/backend/calendar/application/usecase/*
CalendarItem, CalendarItemType, GetCalendarUseCase를 추가했다. 프로젝트, 액션, Todo를 공통 항목으로 표현한다.
역할별 조회 및 저장소 연결
src/main/java/com/module06/backend/calendar/application/service/CalendarQueryService.java, src/main/java/com/module06/backend/project/domain/repository/ProjectRepository.java, src/main/java/com/module06/backend/project/infrastructure/persistence/*
OWNER는 본인이 생성한 프로젝트를 월 기간과 비교한다. LEADER/MEMBER는 회사의 PERSONAL 액션과 개인 Todo를 월 범위로 통합한다. 삭제된 프로젝트는 제외한다.
API 매핑 및 검증
src/main/java/com/module06/backend/calendar/presentation/api/*, src/main/java/com/module06/backend/calendar/presentation/api/response/CalendarItemResponse.java, src/test/java/com/module06/backend/calendar/*
인증 정보와 선택적 month 파라미터를 처리한다. 결과를 CalendarItemResponse로 변환한다. 서비스와 MVC 테스트를 추가했다.

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

Sequence Diagram(s)

sequenceDiagram
  participant CalendarController
  participant CalendarQueryService
  participant ProjectRepository
  participant ActionRepository
  participant PersonalTodoRepository
  CalendarController->>CalendarQueryService: 회사·회원·권한·조회 월 전달
  CalendarQueryService->>ProjectRepository: OWNER 프로젝트 조회
  CalendarQueryService->>ActionRepository: PERSONAL 액션 조회
  CalendarQueryService->>PersonalTodoRepository: 개인 Todo 조회
  CalendarQueryService-->>CalendarController: CalendarItem 목록 반환
Loading

Possibly related PRs

Suggested labels: enhancement

Suggested reviewers: mosungjin

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.55% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목이 캘린더 통합 조회 API 구현이라는 PR의 주요 변경 사항을 명확하게 요약합니다.
Linked Issues check ✅ Passed 단일 캘린더 API, 권한별 조회, 월 필터, 개인 액션·Todo 통합, 프로젝트 기간 겹침 및 테스트 요구사항을 모두 반영합니다 [#246].
Out of Scope Changes check ✅ Passed 변경 사항은 캘린더 통합 조회 구현, 관련 저장소 연동, 응답 모델, 주석 수정 및 테스트 범위에 포함됩니다.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/mnppi-calendar-view

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

🧹 Nitpick comments (1)
src/test/java/com/module06/backend/calendar/presentation/api/CalendarControllerTest.java (1)

65-75: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

기본 월 인자를 직접 검증하세요.

Line 74는 응답이 배열인지 만 검증합니다.
getCalendarUseCase가 다른 YearMonth로 호출되어도 Mockito의 기본 빈 리스트 때문에 이 테스트는 통과할 수 있습니다.
요청 전 YearMonth expectedMonth를 저장하고, verify(getCalendarUseCase)로 그 값을 전달했는지 검증하세요.

🤖 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/test/java/com/module06/backend/calendar/presentation/api/CalendarControllerTest.java`
around lines 65 - 75, Update defaultsToCurrentMonthWhenOmitted to capture
YearMonth.now() in an expectedMonth variable before stubbing and use it in the
getCalendarUseCase expectation. After the request, verify getCalendarUseCase was
called with COMPANY, MEMBER, "MEMBER", and expectedMonth so the default month
argument is explicitly validated.
🤖 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/main/java/com/module06/backend/calendar/application/service/CalendarQueryService.java`:
- Around line 86-89: Update the Personal Todo lookup in CalendarQueryService to
include the current company ID alongside memberId and the date range, using the
corresponding repository method and passing the active company context. Add a
regression test verifying that Todos belonging to another company are excluded
from the current company’s calendar.

---

Nitpick comments:
In
`@src/test/java/com/module06/backend/calendar/presentation/api/CalendarControllerTest.java`:
- Around line 65-75: Update defaultsToCurrentMonthWhenOmitted to capture
YearMonth.now() in an expectedMonth variable before stubbing and use it in the
getCalendarUseCase expectation. After the request, verify getCalendarUseCase was
called with COMPANY, MEMBER, "MEMBER", and expectedMonth so the default month
argument is explicitly validated.
🪄 Autofix

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: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 98512ef1-d92f-4535-8dba-6dabedb0ffaa

📥 Commits

Reviewing files that changed from the base of the PR and between f051806 and ed95660.

📒 Files selected for processing (12)
  • src/main/java/com/module06/backend/calendar/application/service/CalendarQueryService.java
  • src/main/java/com/module06/backend/calendar/application/usecase/CalendarItem.java
  • src/main/java/com/module06/backend/calendar/application/usecase/CalendarItemType.java
  • src/main/java/com/module06/backend/calendar/application/usecase/GetCalendarUseCase.java
  • src/main/java/com/module06/backend/calendar/presentation/api/CalendarController.java
  • src/main/java/com/module06/backend/calendar/presentation/api/TodoController.java
  • src/main/java/com/module06/backend/calendar/presentation/api/response/CalendarItemResponse.java
  • src/main/java/com/module06/backend/project/domain/repository/ProjectRepository.java
  • src/main/java/com/module06/backend/project/infrastructure/persistence/ProjectPersistenceAdapter.java
  • src/main/java/com/module06/backend/project/infrastructure/persistence/SpringDataProjectRepository.java
  • src/test/java/com/module06/backend/calendar/application/service/CalendarQueryServiceTest.java
  • src/test/java/com/module06/backend/calendar/presentation/api/CalendarControllerTest.java

@MNPPI223 MNPPI223 self-assigned this Aug 9, 2026
@MNPPI223 MNPPI223 added the enhancement New feature or request label Aug 9, 2026
@MNPPI223 MNPPI223 added this to Z Aug 9, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Z Aug 9, 2026
TodoController·CalendarController — C 도메인 컨트롤러 전체(project·action)에
@Tag/@operation을 추가하던 김에 이 PR 범위(calendar)도 같이 맞춘다.
로직 변경 없음.

@mosungjin mosungjin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

확인했습니다.

@mosungjin
mosungjin merged commit 04ff269 into develop Aug 9, 2026
9 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Z Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

GET /api/calendar 통합조회 구현

2 participants