Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 31 minutes and 10 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthrough매니저의 오늘 일정 조회 기능이 추가되었습니다. 컨트롤러 엔드포인트( Changes
Sequence DiagramsequenceDiagram
participant Client as Manager(Client)
participant Controller as ManagerScheduleController
participant UseCase as ManagerGetDailyWorkScheduleList
participant Repo as WorkspaceShiftQueryRepository
participant DB as Database
Client->>Controller: GET /today?workspaceId={id}
Controller->>UseCase: execute(ManagerActor, workspaceId)
UseCase->>Repo: getTodayShiftList(workspaceId)
Repo->>DB: Query: shifts for workspaceId within today && status=CONFIRMED
DB-->>Repo: List<WorkspaceShiftTodayResponse>
Repo-->>UseCase: List<WorkspaceShiftTodayResponse>
UseCase->>UseCase: map each -> ManagerTodayScheduleResponseDto
UseCase-->>Controller: List<ManagerTodayScheduleResponseDto>
Controller-->>Client: CommonApiResponse<List<ManagerTodayScheduleResponseDto>>
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@src/main/java/com/dreamteam/alter/adapter/inbound/manager/schedule/controller/ManagerScheduleControllerSpec.java`:
- Around line 55-62: The getTodayScheduleList endpoint in
ManagerScheduleControllerSpec (method getTodayScheduleList) is missing error
ApiResponse entries; update its `@ApiResponses` to include the WORKSPACE_NOT_FOUND
(e.g., 404) and FORBIDDEN (403) responses consistent with other endpoints such
as updateSchedule/updateWorker, providing appropriate responseCode, description,
and example schema/body (matching your CommonApiResponse error format) so
OpenAPI docs show those error cases; ensure you add annotations similar to the
existing error `@ApiResponse` usages for other controller methods.
In
`@src/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceShiftQueryRepositoryImpl.java`:
- Around line 38-39: The code in WorkspaceShiftQueryRepositoryImpl uses
LocalDate.now().atStartOfDay() to compute startOfDay/endOfDay which relies on
the JVM default timezone; update the logic to use an explicit business ZoneId or
an injected Clock to avoid timezone surprises: replace
LocalDate.now().atStartOfDay() with
LocalDate.now(businessZone).atStartOfDay(businessZone) or compute
ZonedDateTime.of(LocalDate.now(businessZone), LocalTime.MIDNIGHT, businessZone)
(or use Clock for testability), ensure startOfDay/endOfDay are created using
that ZoneId/Clock consistently wherever these variables are used.
- Around line 56-59: 해당 클래스 WorkspaceShiftQueryRepositoryImpl의 where 절(현재
.ne(WorkspaceShiftStatus.DELETED) 사용, 메서드 내 startOfDay/endOfDay로 필터링하는 부분)을 다른
유사 메서드들(findByWorkspaceAndDateRange, findByUserAndYearMonth)과 일치시키려면 상태 필터를 삭제
제외(.ne(DELETED))에서 확정 상태 필터(.eq(WorkspaceShiftStatus.CONFIRMED))로 변경하세요; 즉, 문제의
where 조건을 WorkspaceShiftStatus.CONFIRMED와의 동등 비교로 바꿔 일관된 동작을 보장하도록 수정하십시오.
In
`@src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetDailyWorkScheduleList.java`:
- Around line 30-37: The equality check in ManagerGetDailyWorkScheduleList using
workspace.get().getManagerUser().equals(actor.getManagerUser()) relies on entity
equals() and can fail across persistence contexts; change the check to compare
unique IDs (e.g., workspace.get().getManagerUser().getId() vs
actor.getManagerUser().getId() or a managerUserId field on ManagerActor) and
guard against nulls before dereferencing to avoid NPEs; update the conditional
that currently throws CustomException(ErrorCode.FORBIDDEN, ...) to use the ID
comparison instead.
- Around line 30-32: Replace the Optional isEmpty() check and subsequent get()
usage in ManagerGetDailyWorkScheduleList with the orElseThrow pattern: call
workspaceQueryRepository.findById(workspaceId).orElseThrow(() -> new
CustomException(ErrorCode.WORKSPACE_NOT_FOUND)) to directly obtain Workspace or
throw the CustomException; update any variable names accordingly (e.g.,
workspace -> Workspace workspace) and remove the now-unnecessary isEmpty()/get()
branching.
In
`@src/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerGetDailyScheduleListUseCase.java`:
- Around line 3-9: The port interface ManagerGetDailyScheduleListUseCase is
depending on an adapter DTO (ManagerTodayScheduleResponseDto) which violates
hexagonal boundaries; change the interface method signature to return a domain
model (e.g., WorkspaceShiftTodayResponse or a List<WorkspaceShiftTodayResponse>)
instead of ManagerTodayScheduleResponseDto, update the execute method
declaration in ManagerGetDailyScheduleListUseCase accordingly, and move the DTO
mapping to the adapter/controller layer (e.g., ManagerScheduleController should
call
managerGetTodayScheduleList.execute(...).stream().map(ManagerTodayScheduleResponseDto::of)...)
so the domain port has zero infrastructure dependencies.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 43b67f6c-41f4-448c-8005-fbd159e31d3f
📒 Files selected for processing (8)
src/main/java/com/dreamteam/alter/adapter/inbound/manager/schedule/controller/ManagerScheduleController.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/schedule/controller/ManagerScheduleControllerSpec.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/schedule/dto/ManagerTodayScheduleResponseDto.javasrc/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceShiftQueryRepositoryImpl.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetDailyWorkScheduleList.javasrc/main/java/com/dreamteam/alter/domain/workspace/model/WorkspaceShiftTodayResponse.javasrc/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerGetDailyScheduleListUseCase.javasrc/main/java/com/dreamteam/alter/domain/workspace/port/outbound/WorkspaceShiftQueryRepository.java
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (2)
src/main/java/com/dreamteam/alter/adapter/inbound/manager/schedule/controller/ManagerScheduleControllerSpec.java (1)
56-59:⚠️ Potential issue | 🟡 Minor404 응답에도 공통 오류 스키마와 예시를 포함하세요.
현재 404는 설명만 있어 Swagger에서 실제
ErrorResponse포맷을 확인할 수 없습니다. 아래 다른 엔드포인트들과 동일하게content,schema,examples를 추가해 문서 일관성을 맞춰주세요.📝 수정 예시
`@ApiResponses`(value = { `@ApiResponse`(responseCode = "200", description = "금일 스케줄 목록 조회 성공"), - `@ApiResponse`(responseCode = "404", description = "해당 워크스페이스 찾을 수 없음") + `@ApiResponse`(responseCode = "404", description = "실패 케이스", + content = `@Content`( + mediaType = "application/json", + schema = `@Schema`(implementation = ErrorResponse.class), + examples = { + `@ExampleObject`( + name = "해당 워크스페이스 찾을 수 없음", + value = "{\"code\" : \"B008\"}" + ) + })) })🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/java/com/dreamteam/alter/adapter/inbound/manager/schedule/controller/ManagerScheduleControllerSpec.java` around lines 56 - 59, The 404 ApiResponse on ManagerScheduleControllerSpec currently only has a description; update the `@ApiResponses/`@ApiResponse for responseCode = "404" to include a content element with MediaType "application/json" that references the ErrorResponse schema (use the ErrorResponse class/type used elsewhere) and add an examples entry matching the other endpoints' error examples so Swagger shows the common error format consistently; locate the `@ApiResponses` block and modify the `@ApiResponse` for 404 to include content -> schema -> implementation/ErrorResponse and examples analogous to the other controller specs.src/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceShiftQueryRepositoryImpl.java (1)
38-39:⚠️ Potential issue | 🟡 Minor“오늘” 계산에 JVM 기본 타임존이 계속 사용됩니다.
서버 타임존이 비즈니스 기준일과 다르면 금일 스케줄 범위가 어긋날 수 있습니다.
ZoneId또는 주입된Clock기준으로 날짜 경계를 계산하는 편이 안전합니다.🔍 확인 스크립트
#!/bin/bash # 설명: 프로젝트에 명시적인 비즈니스 타임존/Clock 설정이 있는지 확인합니다. # 기대 결과: 금일 기준 계산에 사용할 ZoneId 또는 Clock 설정이 확인되어야 합니다. rg -n -C3 'LocalDate\.now\(\)|ZoneId|Clock|user\.timezone|hibernate\.jdbc\.time_zone|Asia/Seoul' --type java♻️ 수정 예시
- LocalDateTime startOfDay = LocalDate.now().atStartOfDay(); + LocalDateTime startOfDay = LocalDate.now(ZoneId.of("Asia/Seoul")).atStartOfDay(); LocalDateTime endOfDay = startOfDay.plusDays(1);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceShiftQueryRepositoryImpl.java` around lines 38 - 39, The calculation of today in WorkspaceShiftQueryRepositoryImpl uses LocalDate.now() which relies on the JVM default timezone; change the logic that sets startOfDay and endOfDay to use an explicit business ZoneId or an injected Clock instead (e.g., obtain the current LocalDate via LocalDate.now(clock) or get a ZonedDateTime via ZonedDateTime.of(LocalDate.now(clock), LocalTime.MIDNIGHT, businessZone)), then compute startOfDay and endOfDay from that ZonedDateTime (or convert to LocalDateTime/Instant as needed) so all date boundaries are evaluated against the injected Clock/ZoneId rather than the JVM default.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@src/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceShiftQueryRepositoryImpl.java`:
- Around line 40-62: The query in WorkspaceShiftQueryRepositoryImpl uses
groupBy(user.id), which collapses multiple shifts per user into one; change the
grouping to be per-shift (e.g., groupBy(workspaceShift.id) or remove the
user-based grouping) so each workspaceShift.id is returned as a separate row for
WorkspaceShiftTodayResponse; if the intent is only to de-duplicate profile
images, instead limit the joined file per user with a subquery/derived table
that selects a single attached File (by latest id or createdAt) for user.id, and
join that derived result to file rather than grouping by user.id.
In
`@src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetDailyWorkScheduleList.java`:
- Line 8: The use case currently returns an adapter DTO
(ManagerTodayScheduleResponseDto) which breaks hexagonal dependency rules;
change ManagerGetDailyWorkScheduleList.execute to return the application/domain
response model (e.g., WorkspaceShiftTodayResponse or similar domain DTO defined
in the application layer) instead of ManagerTodayScheduleResponseDto, remove the
import of
com.dreamteam.alter.adapter.inbound.manager.schedule.dto.ManagerTodayScheduleResponseDto
from the use case, and move the mapping call ManagerTodayScheduleResponseDto::of
into the controller layer so the controller invokes useCase.execute(...), maps
the returned WorkspaceShiftTodayResponse to ManagerTodayScheduleResponseDto via
ManagerTodayScheduleResponseDto.of, and update any callers/signatures
accordingly.
---
Duplicate comments:
In
`@src/main/java/com/dreamteam/alter/adapter/inbound/manager/schedule/controller/ManagerScheduleControllerSpec.java`:
- Around line 56-59: The 404 ApiResponse on ManagerScheduleControllerSpec
currently only has a description; update the `@ApiResponses/`@ApiResponse for
responseCode = "404" to include a content element with MediaType
"application/json" that references the ErrorResponse schema (use the
ErrorResponse class/type used elsewhere) and add an examples entry matching the
other endpoints' error examples so Swagger shows the common error format
consistently; locate the `@ApiResponses` block and modify the `@ApiResponse` for 404
to include content -> schema -> implementation/ErrorResponse and examples
analogous to the other controller specs.
In
`@src/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceShiftQueryRepositoryImpl.java`:
- Around line 38-39: The calculation of today in
WorkspaceShiftQueryRepositoryImpl uses LocalDate.now() which relies on the JVM
default timezone; change the logic that sets startOfDay and endOfDay to use an
explicit business ZoneId or an injected Clock instead (e.g., obtain the current
LocalDate via LocalDate.now(clock) or get a ZonedDateTime via
ZonedDateTime.of(LocalDate.now(clock), LocalTime.MIDNIGHT, businessZone)), then
compute startOfDay and endOfDay from that ZonedDateTime (or convert to
LocalDateTime/Instant as needed) so all date boundaries are evaluated against
the injected Clock/ZoneId rather than the JVM default.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 1371ef7d-51e8-4abe-8b9c-de2c93583f54
📒 Files selected for processing (3)
src/main/java/com/dreamteam/alter/adapter/inbound/manager/schedule/controller/ManagerScheduleControllerSpec.javasrc/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceShiftQueryRepositoryImpl.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetDailyWorkScheduleList.java
| import org.springframework.stereotype.Service; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
|
|
||
| import com.dreamteam.alter.adapter.inbound.manager.schedule.dto.ManagerTodayScheduleResponseDto; |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
어댑터 DTO 매핑을 컨트롤러 경계로 이동하세요.
Application use case가 adapter.inbound DTO를 직접 반환하면 Hexagonal Architecture의 의존 방향이 깨집니다. execute는 WorkspaceShiftTodayResponse 같은 application/domain 응답 모델을 반환하고, ManagerTodayScheduleResponseDto::of 매핑은 controller에서 수행하는 구조가 더 적절합니다.
♻️ 구조 변경 방향
-import com.dreamteam.alter.adapter.inbound.manager.schedule.dto.ManagerTodayScheduleResponseDto;
+import com.dreamteam.alter.domain.workspace.model.WorkspaceShiftTodayResponse;- public List<ManagerTodayScheduleResponseDto> execute(ManagerActor actor, Long workspaceId) {
+ public List<WorkspaceShiftTodayResponse> execute(ManagerActor actor, Long workspaceId) {
if (!workspaceQueryRepository.existsByIdAndManagerUser(workspaceId, actor.getManagerUser())) {
throw new CustomException(ErrorCode.WORKSPACE_NOT_FOUND);
}
- return workspaceShiftQueryRepository.getTodayShiftList(workspaceId).stream()
- .map(ManagerTodayScheduleResponseDto::of)
- .toList();
+ return workspaceShiftQueryRepository.getTodayShiftList(workspaceId);
}As per coding guidelines, src/main/java/com/dreamteam/alter/application/**: “This is the application layer containing use cases” and “No direct infrastructure dependencies”.
Also applies to: 32-34
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetDailyWorkScheduleList.java`
at line 8, The use case currently returns an adapter DTO
(ManagerTodayScheduleResponseDto) which breaks hexagonal dependency rules;
change ManagerGetDailyWorkScheduleList.execute to return the application/domain
response model (e.g., WorkspaceShiftTodayResponse or similar domain DTO defined
in the application layer) instead of ManagerTodayScheduleResponseDto, remove the
import of
com.dreamteam.alter.adapter.inbound.manager.schedule.dto.ManagerTodayScheduleResponseDto
from the use case, and move the mapping call ManagerTodayScheduleResponseDto::of
into the controller layer so the controller invokes useCase.execute(...), maps
the returned WorkspaceShiftTodayResponse to ManagerTodayScheduleResponseDto via
ManagerTodayScheduleResponseDto.of, and update any callers/signatures
accordingly.
관련 문서
https://www.notion.so/BE-API-343865531628803f98c2e3afff674af2?v=2b186553162880979f62000c6c946512&source=copy_link
Summary by CodeRabbit