Conversation
- workspace 조회 API 응답에 추가됨
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthrough매니저용 고정 근무 스케줄 목록 조회(GET) 및 다음달 고정근무 생성일 업데이트(PATCH) 기능이 추가되고, 관련 DTO/스펙/포트/유스케이스/도메인 및 영속 프로젝션이 확장되었습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant Manager as 매니저
participant Controller as ManagerFixedWorkerScheduleController
participant UseCase as ManagerGetFixedWorkerScheduleList
participant ScheduleRepo as WorkspaceWorkerScheduleQueryRepository
participant WorkspaceRepo as WorkspaceQueryRepository
participant DB as Database
Manager->>Controller: GET /manager/workspaces/{workspaceId}/fixed-schedule
Controller->>Controller: 현재 ManagerActor 조회
Controller->>UseCase: execute(actor, workspaceId)
UseCase->>WorkspaceRepo: 워크스페이스 존재/권한 확인
WorkspaceRepo->>DB: SELECT workspace...
DB-->>WorkspaceRepo: row
WorkspaceRepo-->>UseCase: ManagerWorkspaceResponse
UseCase->>ScheduleRepo: 활성 고정 스케줄 조회
ScheduleRepo->>DB: SELECT worker_schedule WHERE workspace_id=?
DB-->>ScheduleRepo: rows
ScheduleRepo-->>UseCase: List<WorkspaceWorkerSchedule>
UseCase-->>Controller: List<WorkspaceWorkerSchedule>
Controller->>Controller: DTO 매핑 및 200 OK 반환
sequenceDiagram
participant Manager as 매니저
participant Controller as ManagerWorkspaceController
participant UseCase as ManagerUpdateFixedScheduleDate
participant WorkspaceRepo as WorkspaceQueryRepository
participant Workspace as Workspace Entity
participant DB as Database
Manager->>Controller: PATCH /manager/workspaces/{workspaceId}/fixed-schedule
Controller->>Controller: 요청 바디 검증(`@Valid`)
Controller->>Controller: 현재 ManagerActor 조회
Controller->>UseCase: execute(actor, workspaceId, nextMonthShiftGenDay)
UseCase->>WorkspaceRepo: findById(workspaceId)
WorkspaceRepo->>DB: SELECT workspace...
DB-->>WorkspaceRepo: row
WorkspaceRepo-->>UseCase: Workspace Entity
UseCase->>Workspace: 매니저 권한 검증
alt 권한 있음
UseCase->>Workspace: updateNextMonthShiftGenDay(day)
Workspace->>Workspace: nextMonthShiftGenDay = day
WorkspaceRepo->>DB: UPDATE workspace SET next_month_shift_gen_day=?
DB-->>WorkspaceRepo: OK
UseCase-->>Controller: 완료
Controller-->>Manager: 200 OK
else 권한 없음/미존재
UseCase-->>Controller: CustomException (4xx)
Controller-->>Manager: 4xx Error
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
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)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Comment |
There was a problem hiding this comment.
Actionable comments posted: 10
🤖 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/workspace/controller/ManagerWorkspaceController.java`:
- Line 48: The field managerUpdateFixedScheduleDate of type
ManagerUpdateFixedScheduleDateUseCase is missing the consistent `@Resource`(name =
"...") injection annotation; add `@Resource`(name =
"managerUpdateFixedScheduleDateUseCase") (and import javax.annotation.Resource)
above the private final ManagerUpdateFixedScheduleDateUseCase
managerUpdateFixedScheduleDate declaration so it matches the other use case
injections and preserves the existing injection naming convention.
In
`@src/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/dto/ManagerWorkspaceResponseDto.java`:
- Around line 62-64: The `@NotNull` annotation on the primitive field
nextMonthShiftGenDay in ManagerWorkspaceResponseDto is ineffective; remove the
`@NotNull` from the int nextMonthShiftGenDay declaration or, if you need to
represent nullable values, change the field type to Integer and keep `@NotNull`
only if you then enforce non-null at runtime/validation; update
ManagerWorkspaceResponseDto accordingly (adjust any downstream code or
validation expectations when switching types).
In
`@src/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceWorkerScheduleQueryRepositoryImpl.java`:
- Around line 89-105: The single-ID method
findAllActivatedWithWorkspaceWorkerByWorkspaceId duplicates the query logic in
findAllActivatedWithWorkspaceWorkerByWorkspaceIds; refactor by delegating:
implement findAllActivatedWithWorkspaceWorkerByWorkspaceId to call
findAllActivatedWithWorkspaceWorkerByWorkspaceIds(Collections.singletonList(workspaceId))
(or List.of(workspaceId)) and return that result, removing the duplicated
QueryDSL code; ensure you keep the same filtering (qWorkspace.id,
qWorkspaceWorkerSchedule.status, qWorkspaceWorker.status) and return type
List<WorkspaceWorkerSchedule>.
In
`@src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetFixedWorkerScheduleList.java`:
- Around line 27-36: The permission check in
ManagerUpdateFixedScheduleDate.execute (or its method performing the manager
validation) is inverted: it currently throws when
workspace.getManagerUser().equals(actor.getManagerUser()) allowing others to
modify; change the condition to throw when the manager users are NOT equal
(negate the equals) so only the actual workspace manager can proceed, i.e.,
update the authorization check in ManagerUpdateFixedScheduleDate (the block that
throws CustomException with ErrorCode.FORBIDDEN) to use the correct logical
negation.
- Around line 19-22: The service class ManagerGetFixedWorkerScheduleList is
missing an explicit bean name on its `@Service` annotation; update the annotation
to include a descriptive bean name following our convention (for example
"managerGetFixedWorkerScheduleList") so the class
ManagerGetFixedWorkerScheduleList implements
ManagerGetFixedWorkerScheduleListUseCase is registered with that explicit name;
ensure the chosen string matches the naming pattern used for other services in
the codebase.
In
`@src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateFixedScheduleDate.java`:
- Around line 16-19: The `@Service` on ManagerUpdateFixedScheduleDate lacks an
explicit bean name; to match other use-cases and allow `@Resource`(name="...")
injection, add a named service value (e.g.
`@Service`("managerUpdateFixedScheduleDate")) to the
ManagerUpdateFixedScheduleDate class so its bean name is consistent with the
pattern used by other use-case beans and the controller that expects named
injection of ManagerUpdateFixedScheduleDateUseCase.
- Around line 28-30: The authorization check in ManagerUpdateFixedScheduleDate
is inverted: currently it throws when
workspace.getManagerUser().equals(actor.getManagerUser()), but it should throw
when they do NOT match. Fix the condition in the access control block inside
ManagerUpdateFixedScheduleDate to throw new CustomException(ErrorCode.FORBIDDEN,
"관리 중인 업장이 아닙니다.") when
!workspace.getManagerUser().equals(actor.getManagerUser()) (or replace with the
same existsByIdAndManagerUser-style check used in
ManagerGetFixedWorkerScheduleList) so only the actual manager is allowed to
proceed.
In `@src/main/java/com/dreamteam/alter/domain/workspace/entity/Workspace.java`:
- Around line 113-115: The method Workspace.updateNextMonthShiftGenDay currently
assigns the incoming day directly to nextMonthShiftGenDay; add validation to
enforce the domain invariant (1–31) before assignment, and throw an
IllegalArgumentException with a clear message if the value is out of range;
update the method to check the int parameter (day) against 1 and 31, reject
invalid values, and only then set this.nextMonthShiftGenDay = day so the
Workspace entity preserves its business rules.
In
`@src/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerGetFixedWorkerScheduleListUseCase.java`:
- Around line 5-9: The domain port ManagerGetFixedWorkerScheduleListUseCase
currently depends on the adapter DTO FixedWorkerScheduleResponseDto; change the
interface signature of execute(ManagerActor actor, Long workspaceId) to return a
domain-only type (e.g., List<FixedWorkerSchedule> or a new domain response
interface like FixedWorkerScheduleProjection) instead of
FixedWorkerScheduleResponseDto, remove the import of
FixedWorkerScheduleResponseDto from this file, and ensure any mapping from the
domain type to FixedWorkerScheduleResponseDto happens in the adapter/controller
layer where the DTO lives.
In
`@src/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerUpdateFixedScheduleDateUseCase.java`:
- Around line 3-7: The interface ManagerUpdateFixedScheduleDateUseCase currently
imports the adapter DTO UpdateFixedScheduleDateRequestDto, violating hexagonal
boundaries; replace that dependency by changing the execute signature on
ManagerUpdateFixedScheduleDateUseCase to accept a domain-safe type (either a
primitive like int nextMonthShiftGenDay or a new domain command class e.g.,
ManagerUpdateFixedScheduleDateCommand defined in the domain package) and remove
the import of UpdateFixedScheduleDateRequestDto; then update all implementations
and inbound adapters to map their adapter DTO
(UpdateFixedScheduleDateRequestDto) into the new primitive or the new domain
command before calling
ManagerUpdateFixedScheduleDateUseCase.execute(ManagerActor, Long, ...).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: a49ecb84-ba95-491b-9400-586ae470e65b
📒 Files selected for processing (16)
src/main/java/com/dreamteam/alter/adapter/inbound/manager/schedule/controller/ManagerFixedWorkerScheduleController.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/schedule/controller/ManagerFixedWorkerScheduleControllerSpec.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/schedule/dto/FixedWorkerScheduleResponseDto.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/controller/ManagerWorkspaceController.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/controller/ManagerWorkspaceControllerSpec.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/dto/ManagerWorkspaceResponseDto.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/dto/UpdateFixedScheduleDateRequestDto.javasrc/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceQueryRepositoryImpl.javasrc/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceWorkerScheduleQueryRepositoryImpl.javasrc/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/readonly/ManagerWorkspaceResponse.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetFixedWorkerScheduleList.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateFixedScheduleDate.javasrc/main/java/com/dreamteam/alter/domain/workspace/entity/Workspace.javasrc/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerGetFixedWorkerScheduleListUseCase.javasrc/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerUpdateFixedScheduleDateUseCase.javasrc/main/java/com/dreamteam/alter/domain/workspace/port/outbound/WorkspaceWorkerScheduleQueryRepository.java
...dreamteam/alter/adapter/inbound/manager/workspace/controller/ManagerWorkspaceController.java
Show resolved
Hide resolved
...a/com/dreamteam/alter/adapter/inbound/manager/workspace/dto/ManagerWorkspaceResponseDto.java
Outdated
Show resolved
Hide resolved
...alter/adapter/outbound/workspace/persistence/WorkspaceWorkerScheduleQueryRepositoryImpl.java
Outdated
Show resolved
Hide resolved
...ava/com/dreamteam/alter/application/workspace/usecase/ManagerGetFixedWorkerScheduleList.java
Outdated
Show resolved
Hide resolved
...ava/com/dreamteam/alter/application/workspace/usecase/ManagerGetFixedWorkerScheduleList.java
Show resolved
Hide resolved
...n/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateFixedScheduleDate.java
Outdated
Show resolved
Hide resolved
...n/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateFixedScheduleDate.java
Outdated
Show resolved
Hide resolved
src/main/java/com/dreamteam/alter/domain/workspace/entity/Workspace.java
Show resolved
Hide resolved
.../dreamteam/alter/domain/workspace/port/inbound/ManagerGetFixedWorkerScheduleListUseCase.java
Show resolved
Hide resolved
...com/dreamteam/alter/domain/workspace/port/inbound/ManagerUpdateFixedScheduleDateUseCase.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateFixedWorkerSchedule.java (1)
29-33:⚠️ Potential issue | 🔴 Critical대상 스케줄의 업장 소속 검증이 없습니다.
Line 29-33은 “이 매니저가 어떤 업장을 하나 관리하는지”와 “이 스케줄 ID가 존재하는지”만 각각 확인합니다. 그래서 다른 업장에 속한
workerScheduleId도 수정할 수 있습니다. 조회 단계에서workerScheduleId가workspaceId에 속하는지 함께 검증해야 합니다.🤖 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/ManagerUpdateFixedWorkerSchedule.java` around lines 29 - 33, Add validation that the fetched WorkspaceWorkerSchedule actually belongs to the given workspaceId: after calling workspaceWorkerScheduleQueryRepository.getByIdWithWorkspaceWorker(workerScheduleId) (or by using a repository method that fetches by both workerScheduleId and workspaceId), check the schedule's workspace id (e.g., workspaceWorkerSchedule.getWorkspace().getId()) against workspaceId and throw a CustomException(ErrorCode.WORKSPACE_NOT_FOUND) (or ErrorCode.NOT_FOUND with an appropriate message) when they don’t match so managers cannot modify schedules from other workspaces.src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerCreateFixedWorkerSchedule.java (1)
35-39:⚠️ Potential issue | 🔴 Critical
workspaceWorkerId소속 업장 검증이 빠져 있습니다.Line 35-39 조합으로는 매니저가 자신이 관리하는 아무
workspaceId만 통과시키고, 다른 업장의workspaceWorkerId로도 고정 스케줄을 생성할 수 있습니다.WorkspaceWorker조회를workspaceId까지 포함해서 제한하거나, 조회 후 해당 근무자가 요청한 업장 소속인지 명시적으로 검증해야 합니다.🤖 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/ManagerCreateFixedWorkerSchedule.java` around lines 35 - 39, The code allows creating a schedule for a WorkspaceWorker that may belong to a different workspace because the WorkspaceWorker lookup lacks workspace scoping; update the lookup to enforce workspace ownership by either using a repository method that includes workspaceId (e.g., change workspaceWorkerQueryRepository.findById(...) to findByIdAndWorkspaceId(request.getWorkspaceWorkerId(), workspaceId)) or after fetching the WorkspaceWorker (variable workspaceWorker) explicitly validate workspaceWorker.getWorkspace().getId() (or workspaceWorker.getWorkspaceId()) equals workspaceId and throw the same CustomException (ErrorCode.NOT_FOUND, "해당 업장에 근무하는 사용자가 아닙니다.") on mismatch. Ensure the check replaces or supplements the existing existsByIdAndManagerUser check in ManagerCreateFixedWorkerSchedule so only workers of the manager's workspace can be scheduled.
♻️ Duplicate comments (1)
src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateFixedScheduleDate.java (1)
28-30:⚠️ Potential issue | 🔴 Critical권한 검증 조건이 반대로 되어 있습니다.
Line 28-30은 실제 담당 매니저일 때
FORBIDDEN을 던지고, 다른 매니저는 그대로 통과시킵니다. 부정이 빠졌습니다.🐛 수정 제안
- if (workspace.getManagerUser().equals(actor.getManagerUser())) { + if (!workspace.getManagerUser().equals(actor.getManagerUser())) { throw new CustomException(ErrorCode.FORBIDDEN, "관리 중인 업장이 아닙니다."); }🤖 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/ManagerUpdateFixedScheduleDate.java` around lines 28 - 30, The permission check in ManagerUpdateFixedScheduleDate is inverted: currently it throws FORBIDDEN when workspace.getManagerUser().equals(actor.getManagerUser()), which is backwards. Change the condition to throw when the actor is NOT the manager (e.g., use negation of equals or reverse the comparison) so that if (!workspace.getManagerUser().equals(actor.getManagerUser())) then throw new CustomException(ErrorCode.FORBIDDEN, "관리 중인 업장이 아닙니다."); ensuring the Authorization logic in this class/method correctly blocks non-managers.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In
`@src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerCreateFixedWorkerSchedule.java`:
- Around line 35-39: The code allows creating a schedule for a WorkspaceWorker
that may belong to a different workspace because the WorkspaceWorker lookup
lacks workspace scoping; update the lookup to enforce workspace ownership by
either using a repository method that includes workspaceId (e.g., change
workspaceWorkerQueryRepository.findById(...) to
findByIdAndWorkspaceId(request.getWorkspaceWorkerId(), workspaceId)) or after
fetching the WorkspaceWorker (variable workspaceWorker) explicitly validate
workspaceWorker.getWorkspace().getId() (or workspaceWorker.getWorkspaceId())
equals workspaceId and throw the same CustomException (ErrorCode.NOT_FOUND, "해당
업장에 근무하는 사용자가 아닙니다.") on mismatch. Ensure the check replaces or supplements the
existing existsByIdAndManagerUser check in ManagerCreateFixedWorkerSchedule so
only workers of the manager's workspace can be scheduled.
In
`@src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateFixedWorkerSchedule.java`:
- Around line 29-33: Add validation that the fetched WorkspaceWorkerSchedule
actually belongs to the given workspaceId: after calling
workspaceWorkerScheduleQueryRepository.getByIdWithWorkspaceWorker(workerScheduleId)
(or by using a repository method that fetches by both workerScheduleId and
workspaceId), check the schedule's workspace id (e.g.,
workspaceWorkerSchedule.getWorkspace().getId()) against workspaceId and throw a
CustomException(ErrorCode.WORKSPACE_NOT_FOUND) (or ErrorCode.NOT_FOUND with an
appropriate message) when they don’t match so managers cannot modify schedules
from other workspaces.
---
Duplicate comments:
In
`@src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateFixedScheduleDate.java`:
- Around line 28-30: The permission check in ManagerUpdateFixedScheduleDate is
inverted: currently it throws FORBIDDEN when
workspace.getManagerUser().equals(actor.getManagerUser()), which is backwards.
Change the condition to throw when the actor is NOT the manager (e.g., use
negation of equals or reverse the comparison) so that if
(!workspace.getManagerUser().equals(actor.getManagerUser())) then throw new
CustomException(ErrorCode.FORBIDDEN, "관리 중인 업장이 아닙니다."); ensuring the
Authorization logic in this class/method correctly blocks non-managers.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: d5b3cf1b-28c1-4c6a-8671-62bba009c6e4
📒 Files selected for processing (7)
src/main/java/com/dreamteam/alter/adapter/inbound/manager/schedule/controller/ManagerFixedWorkerScheduleController.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/controller/ManagerWorkspaceController.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/dto/ManagerWorkspaceResponseDto.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerCreateFixedWorkerSchedule.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetFixedWorkerScheduleList.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateFixedScheduleDate.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateFixedWorkerSchedule.java
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/java/com/dreamteam/alter/domain/workspace/entity/Workspace.java (1)
3-11: 🧹 Nitpick | 🔵 Trivial도메인 레이어 인프라 의존성 존재 (기존 이슈)
코딩 가이드라인에 따르면 도메인 레이어는 "ZERO infrastructure dependencies (no Spring, no JPA annotations, no external libs)"를 준수해야 합니다. 현재 파일에는 JPA(
jakarta.persistence.*), Spring Data(org.springframework.data.*), Lombok 등의 인프라 의존성이 존재합니다.이 PR에서 추가된
CustomException/ErrorCode임포트는 애플리케이션 레벨의 공통 예외 처리로서 외부 프레임워크 의존성은 아니지만, 순수 도메인 관점에서는 도메인 전용 예외 타입이 더 적합할 수 있습니다.단, 기존 JPA 어노테이션 사용은 이 PR에서 도입된 것이 아니므로, 아키텍처 리팩토링 시 별도로 검토하시기 바랍니다.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/java/com/dreamteam/alter/domain/workspace/entity/Workspace.java` around lines 3 - 11, The Workspace domain class currently depends on infrastructure libraries (jakarta.persistence.*, org.springframework.data.*, lombok) which violates the zero-infrastructure rule; remove all JPA/Spring Data and Lombok annotations/imports from the Workspace domain class (references: class Workspace, ManagerUser, WorkspaceStatus) and make it a plain POJO (explicit fields, constructors, getters/setters) in the domain module; instead create a separate persistence mapping (e.g., WorkspaceEntity) in the infrastructure/persistence layer that contains `@Entity/`@Table/@Id/@GeneratedValue/@CreatedDate/@LastModifiedDate/@EntityListeners and maps to/from the domain Workspace; also replace or wrap application-level CustomException/ErrorCode usage with a domain-specific exception type if needed (or keep but move handling to application layer) so the domain package no longer imports JPA/Spring Data/Lombok.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/main/java/com/dreamteam/alter/domain/workspace/entity/Workspace.java`:
- Around line 3-11: The Workspace domain class currently depends on
infrastructure libraries (jakarta.persistence.*, org.springframework.data.*,
lombok) which violates the zero-infrastructure rule; remove all JPA/Spring Data
and Lombok annotations/imports from the Workspace domain class (references:
class Workspace, ManagerUser, WorkspaceStatus) and make it a plain POJO
(explicit fields, constructors, getters/setters) in the domain module; instead
create a separate persistence mapping (e.g., WorkspaceEntity) in the
infrastructure/persistence layer that contains
`@Entity/`@Table/@Id/@GeneratedValue/@CreatedDate/@LastModifiedDate/@EntityListeners
and maps to/from the domain Workspace; also replace or wrap application-level
CustomException/ErrorCode usage with a domain-specific exception type if needed
(or keep but move handling to application layer) so the domain package no longer
imports JPA/Spring Data/Lombok.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 7b0b1aeb-7f88-4bca-a675-f4129e98e376
📒 Files selected for processing (1)
src/main/java/com/dreamteam/alter/domain/workspace/entity/Workspace.java
|
@coderabbitai 재리뷰해봐 |
|
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/application/workspace/usecase/ManagerGetFixedWorkerScheduleList.java`:
- Line 8: The import of adapter DTO FixedWorkerScheduleResponseDto in
ManagerGetFixedWorkerScheduleList.java is unused and creates an infrastructure
dependency; remove the import and any references to adapter-layer DTOs from this
use case class, and instead use an application-layer DTO or domain model (create
or reference a ManagerFixedWorkerScheduleResponse or domain object) and perform
mapping inside the adapter layer (or a mapper like FixedWorkerScheduleMapper) so
the application use case does not depend on
com.dreamteam.alter.adapter.inbound.*.
In
`@src/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerGetFixedWorkerScheduleListUseCase.java`:
- Line 5: Remove the unused adapter DTO import FixedWorkerScheduleResponseDto
from the ManagerGetFixedWorkerScheduleListUseCase interface and any lingering
references to adapter-layer types in that file; ensure the interface only
exposes domain types (e.g., List<WorkspaceWorkerSchedule>) and does not import
or depend on adapter DTOs so the domain layer has zero infrastructure/adapter
dependencies.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 91dd1a7b-b6d5-4624-936c-afcd0b4abe60
📒 Files selected for processing (3)
src/main/java/com/dreamteam/alter/adapter/inbound/manager/schedule/controller/ManagerFixedWorkerScheduleController.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetFixedWorkerScheduleList.javasrc/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerGetFixedWorkerScheduleListUseCase.java
...ava/com/dreamteam/alter/application/workspace/usecase/ManagerGetFixedWorkerScheduleList.java
Show resolved
Hide resolved
.../dreamteam/alter/domain/workspace/port/inbound/ManagerGetFixedWorkerScheduleListUseCase.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (3)
src/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerUpdateFixedScheduleDateUseCase.java (1)
1-8:⚠️ Potential issue | 🟠 Major도메인 레이어에서 어댑터 DTO를 import하고 있습니다 (아키텍처 위반)
이전 리뷰에서도 지적된 문제입니다.
domain.workspace.port.inbound패키지의 인터페이스가adapter.inbound패키지의UpdateFixedScheduleDateRequestDto를 import하고 있어 헥사고날 아키텍처의 의존성 방향이 역전되었습니다.도메인 레이어는 어댑터 레이어에 대한 의존성이 없어야 합니다.
🛠️ 수정 제안: 원시 타입 사용
package com.dreamteam.alter.domain.workspace.port.inbound; -import com.dreamteam.alter.adapter.inbound.manager.workspace.dto.UpdateFixedScheduleDateRequestDto; import com.dreamteam.alter.domain.user.context.ManagerActor; public interface ManagerUpdateFixedScheduleDateUseCase { - void execute(ManagerActor actor, Long workspaceId, UpdateFixedScheduleDateRequestDto request); + void execute(ManagerActor actor, Long workspaceId, int nextMonthShiftGenDay); }컨트롤러에서 DTO의 값을 추출하여 use case에 전달하면 됩니다:
useCase.execute(actor, workspaceId, request.nextMonthShiftGenDay());As per coding guidelines: "domain/** - ZERO infrastructure dependencies", "Port interfaces are clean contracts with no implementation details."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerUpdateFixedScheduleDateUseCase.java` around lines 1 - 8, The interface ManagerUpdateFixedScheduleDateUseCase in domain.workspace.port.inbound incorrectly imports the adapter DTO UpdateFixedScheduleDateRequestDto; remove that dependency so the domain port takes primitive/POJO params instead (e.g., replace the DTO parameter in execute with the raw value(s) like the nextMonthShiftGenDay) and update callers (controller/adapters) to extract values from UpdateFixedScheduleDateRequestDto and pass them into ManagerUpdateFixedScheduleDateUseCase.execute(ManagerActor actor, Long workspaceId, /*raw params*/); keep ManagerActor and the execute method signature in the domain layer free of adapter types.src/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerGetFixedWorkerScheduleListUseCase.java (1)
5-5:⚠️ Potential issue | 🟡 Minor도메인 포트에 어댑터 DTO import가 아직 남아 있습니다.
현재 시그니처에서는 전혀 쓰이지 않는데도
domain -> adapter컴파일 의존성이 생깁니다. 이 import는 제거하는 편이 맞습니다.🔧 정리 제안
-import com.dreamteam.alter.adapter.inbound.manager.schedule.dto.FixedWorkerScheduleResponseDto;As per coding guidelines, "ZERO infrastructure dependencies (no Spring, no JPA annotations, no external libs)." and "Port interfaces (inbound/outbound) are clean contracts with no implementation details."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerGetFixedWorkerScheduleListUseCase.java` at line 5, Remove the adapter DTO import FixedWorkerScheduleResponseDto from the domain port ManagerGetFixedWorkerScheduleListUseCase and ensure the port interface does not reference any adapter-level types; delete the unused import line and, if a return/type is needed, replace any occurrences with a domain-level type or a clean contract type declared in the domain port (i.e., use domain DTO/class or an interface defined in the domain package rather than FixedWorkerScheduleResponseDto).src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetFixedWorkerScheduleList.java (1)
8-8:⚠️ Potential issue | 🟡 Minor애플리케이션 레이어에 어댑터 DTO import가 남아 있습니다.
이 클래스는 도메인 엔티티를 반환하므로
FixedWorkerScheduleResponseDtoimport는 불필요하고, 그대로 두면 application 계층이 adapter 패키지에 의존하게 됩니다.🔧 정리 제안
-import com.dreamteam.alter.adapter.inbound.manager.schedule.dto.FixedWorkerScheduleResponseDto;As per coding guidelines, "No direct infrastructure dependencies (no Spring Data, no HTTP clients)."
🤖 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/ManagerGetFixedWorkerScheduleList.java` at line 8, The import of adapter DTO FixedWorkerScheduleResponseDto in ManagerGetFixedWorkerScheduleList creates an infrastructure dependency in the application layer; remove the FixedWorkerScheduleResponseDto import and any references to that DTO inside ManagerGetFixedWorkerScheduleList, and make the method(s) return and work with the appropriate domain entity or application-level DTO instead (update method signatures/return types and mapping logic within ManagerGetFixedWorkerScheduleList to use the domain model rather than FixedWorkerScheduleResponseDto).
🤖 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/application/workspace/usecase/ManagerUpdateFixedScheduleDate.java`:
- Around line 6-12: The ManagerUpdateFixedScheduleDate application use case
currently depends on the adapter DTO UpdateFixedScheduleDateRequestDto; change
the boundary so the use case (class ManagerUpdateFixedScheduleDate and its
execute/update method) accepts a primitive/int or a dedicated command object
(e.g., Integer nextMonthShiftGenDay or UpdateFixedScheduleDateCommand) instead
of the DTO, and update callers (controller/inbound adapter) to extract
request.nextMonthShiftGenDay() and pass that value; remove direct imports/usages
of UpdateFixedScheduleDateRequestDto from this class (and related lines 24-32)
so the application layer no longer depends on inbound adapter types.
---
Duplicate comments:
In
`@src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetFixedWorkerScheduleList.java`:
- Line 8: The import of adapter DTO FixedWorkerScheduleResponseDto in
ManagerGetFixedWorkerScheduleList creates an infrastructure dependency in the
application layer; remove the FixedWorkerScheduleResponseDto import and any
references to that DTO inside ManagerGetFixedWorkerScheduleList, and make the
method(s) return and work with the appropriate domain entity or
application-level DTO instead (update method signatures/return types and mapping
logic within ManagerGetFixedWorkerScheduleList to use the domain model rather
than FixedWorkerScheduleResponseDto).
In
`@src/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerGetFixedWorkerScheduleListUseCase.java`:
- Line 5: Remove the adapter DTO import FixedWorkerScheduleResponseDto from the
domain port ManagerGetFixedWorkerScheduleListUseCase and ensure the port
interface does not reference any adapter-level types; delete the unused import
line and, if a return/type is needed, replace any occurrences with a
domain-level type or a clean contract type declared in the domain port (i.e.,
use domain DTO/class or an interface defined in the domain package rather than
FixedWorkerScheduleResponseDto).
In
`@src/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerUpdateFixedScheduleDateUseCase.java`:
- Around line 1-8: The interface ManagerUpdateFixedScheduleDateUseCase in
domain.workspace.port.inbound incorrectly imports the adapter DTO
UpdateFixedScheduleDateRequestDto; remove that dependency so the domain port
takes primitive/POJO params instead (e.g., replace the DTO parameter in execute
with the raw value(s) like the nextMonthShiftGenDay) and update callers
(controller/adapters) to extract values from UpdateFixedScheduleDateRequestDto
and pass them into ManagerUpdateFixedScheduleDateUseCase.execute(ManagerActor
actor, Long workspaceId, /*raw params*/); keep ManagerActor and the execute
method signature in the domain layer free of adapter types.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: b4844547-502f-4f35-92ba-8b1e93bb58dd
📒 Files selected for processing (16)
src/main/java/com/dreamteam/alter/adapter/inbound/manager/schedule/controller/ManagerFixedWorkerScheduleController.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/schedule/controller/ManagerFixedWorkerScheduleControllerSpec.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/schedule/dto/FixedWorkerScheduleResponseDto.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/controller/ManagerWorkspaceController.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/controller/ManagerWorkspaceControllerSpec.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/dto/ManagerWorkspaceResponseDto.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/dto/UpdateFixedScheduleDateRequestDto.javasrc/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceQueryRepositoryImpl.javasrc/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/readonly/ManagerWorkspaceResponse.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerCreateFixedWorkerSchedule.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetFixedWorkerScheduleList.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateFixedScheduleDate.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateFixedWorkerSchedule.javasrc/main/java/com/dreamteam/alter/domain/workspace/entity/Workspace.javasrc/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerGetFixedWorkerScheduleListUseCase.javasrc/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerUpdateFixedScheduleDateUseCase.java
...n/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateFixedScheduleDate.java
Show resolved
Hide resolved
|
@coderabbitai 재리뷰 해봐 |
|
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateFixedWorkerSchedule.java (1)
29-33:⚠️ Potential issue | 🔴 Critical스케줄 조회를
workspaceId범위로 제한해야 합니다.여기서는
actor가 관리하는 아무workspaceId만 통과하면, 실제 수정 대상workerScheduleId는 전역 조회로 가져와 바로 업데이트합니다. 그래서 다른 업장의workerScheduleId를 알고 있으면 이 경로로 수정할 수 있습니다.workerScheduleId + workspaceId로 함께 조회하거나, 조회 후 해당 스케줄이 정말workspaceId에 속하는지 검증이 필요합니다.🤖 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/ManagerUpdateFixedWorkerSchedule.java` around lines 29 - 33, The code currently checks workspace ownership via workspaceQueryRepository.existsByIdAndManagerUser(workspaceId, actor.getManagerUser()) but then fetches the schedule by workerScheduleId globally using workspaceWorkerScheduleQueryRepository.getByIdWithWorkspaceWorker(workerScheduleId), allowing cross-workspace edits; change the lookup to restrict by both workerScheduleId and workspaceId (e.g. add or use a repository method like getByIdAndWorkspaceIdWithWorkspaceWorker(workerScheduleId, workspaceId)) or after getByIdWithWorkspaceWorker validate that the returned WorkspaceWorkerSchedule.workspace.id equals workspaceId and throw CustomException(ErrorCode.NOT_FOUND) if it does not; update references to workerScheduleId, workspaceId, workspaceWorkerScheduleQueryRepository.getByIdWithWorkspaceWorker, and workspaceQueryRepository.existsByIdAndManagerUser accordingly.
🤖 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/application/workspace/usecase/ManagerUpdateFixedScheduleDate.java`:
- Around line 24-29: Replace the two-step lookup+ownership check in
ManagerUpdateFixedScheduleDate with a single ownership-aware query: call a
repository method that finds by workspaceId and manager (e.g.,
workspaceQueryRepository.findByIdAndManagerUser(...) or
findByIdAndManagerUserId(...)) and .orElseThrow(() -> new
CustomException(ErrorCode.WORKSPACE_NOT_FOUND)); remove the subsequent manager
equals check and the FORBIDDEN branch so missing/unauthorized lookups both
return 404, and update ManagerWorkspaceControllerSpec's 409
documentation/assertion to reflect the new 404 behavior.
In
`@src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateFixedWorkerSchedule.java`:
- Line 19: The `@Service` bean name "managerUpdateWorkerSchedule" is inconsistent
with the fixed-worker schedule usecase naming and risks miswiring; rename the
bean on the ManagerUpdateFixedWorkerSchedule class to follow the existing
pattern (e.g., "managerUpdateFixedWorkerSchedule") so it matches
ManagerCreateFixedWorkerSchedule and ManagerGetFixedWorkerScheduleList and any
name-based injection or map binding; update the `@Service`(...) value on the
ManagerUpdateFixedWorkerSchedule class accordingly.
In
`@src/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerUpdateFixedScheduleDateUseCase.java`:
- Around line 5-7: The parameter name int request in the
ManagerUpdateFixedScheduleDateUseCase.execute signature is unclear; rename it to
a meaningful name like nextMonthShiftGenDay or day in the interface
(ManagerUpdateFixedScheduleDateUseCase) and update all implementing classes and
call sites (methods that implement execute(ManagerActor, Long, ...), any usages)
to use the new parameter name so the intent is clear and compilation remains
correct.
---
Outside diff comments:
In
`@src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateFixedWorkerSchedule.java`:
- Around line 29-33: The code currently checks workspace ownership via
workspaceQueryRepository.existsByIdAndManagerUser(workspaceId,
actor.getManagerUser()) but then fetches the schedule by workerScheduleId
globally using
workspaceWorkerScheduleQueryRepository.getByIdWithWorkspaceWorker(workerScheduleId),
allowing cross-workspace edits; change the lookup to restrict by both
workerScheduleId and workspaceId (e.g. add or use a repository method like
getByIdAndWorkspaceIdWithWorkspaceWorker(workerScheduleId, workspaceId)) or
after getByIdWithWorkspaceWorker validate that the returned
WorkspaceWorkerSchedule.workspace.id equals workspaceId and throw
CustomException(ErrorCode.NOT_FOUND) if it does not; update references to
workerScheduleId, workspaceId,
workspaceWorkerScheduleQueryRepository.getByIdWithWorkspaceWorker, and
workspaceQueryRepository.existsByIdAndManagerUser accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4ecbba4b-43b9-4851-85d7-878bc63c9526
📒 Files selected for processing (16)
src/main/java/com/dreamteam/alter/adapter/inbound/manager/schedule/controller/ManagerFixedWorkerScheduleController.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/schedule/controller/ManagerFixedWorkerScheduleControllerSpec.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/schedule/dto/FixedWorkerScheduleResponseDto.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/controller/ManagerWorkspaceController.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/controller/ManagerWorkspaceControllerSpec.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/dto/ManagerWorkspaceResponseDto.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/dto/UpdateFixedScheduleDateRequestDto.javasrc/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceQueryRepositoryImpl.javasrc/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/readonly/ManagerWorkspaceResponse.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerCreateFixedWorkerSchedule.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetFixedWorkerScheduleList.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateFixedScheduleDate.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateFixedWorkerSchedule.javasrc/main/java/com/dreamteam/alter/domain/workspace/entity/Workspace.javasrc/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerGetFixedWorkerScheduleListUseCase.javasrc/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerUpdateFixedScheduleDateUseCase.java
...n/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateFixedScheduleDate.java
Outdated
Show resolved
Hide resolved
...java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateFixedWorkerSchedule.java
Outdated
Show resolved
Hide resolved
...com/dreamteam/alter/domain/workspace/port/inbound/ManagerUpdateFixedScheduleDateUseCase.java
Show resolved
Hide resolved
|
@coderabbitai 재리뷰 |
|
✅ Actions performedFull review triggered. |
.../alter/adapter/inbound/manager/schedule/controller/ManagerFixedWorkerScheduleController.java
Outdated
Show resolved
Hide resolved
...com/dreamteam/alter/adapter/inbound/manager/schedule/dto/FixedWorkerScheduleResponseDto.java
Show resolved
Hide resolved
...dreamteam/alter/adapter/inbound/manager/workspace/dto/UpdateFixedScheduleDateRequestDto.java
Outdated
Show resolved
Hide resolved
...ava/com/dreamteam/alter/application/workspace/usecase/ManagerGetFixedWorkerScheduleList.java
Outdated
Show resolved
Hide resolved
...n/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateFixedScheduleDate.java
Outdated
Show resolved
Hide resolved
...dreamteam/alter/adapter/inbound/manager/workspace/controller/ManagerWorkspaceController.java
Outdated
Show resolved
Hide resolved
기타 컨벤션 포함
swagger 설명 추가
관련 문서
https://www.notion.so/BE-API-31186553162880d28d4cffecb3a78736?source=copy_link
Summary by CodeRabbit
새로운 기능
유효성 검사