feat: [ALT-258] 업장 대표이미지 관리 기능 추가 (최대 5개)#91
Conversation
|
Warning Review limit reached
More reviews will be available in 18 minutes and 2 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the 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 credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. 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, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (32)
📝 WalkthroughWalkthrough업장 대표이미지 관리 기능을 전 계층에 걸쳐 추가한다. Changes업장 대표이미지 기능 전체
Sequence Diagram(s)sequenceDiagram
participant Client
participant ManagerWorkspaceImageController
participant ManagerUpdateWorkspaceImages
participant WorkspaceImageQueryRepository
participant AttachFilesUseCase
participant FileDeleteService
participant WorkspaceImageRepository
Client->>ManagerWorkspaceImageController: PATCH /manager/workspaces/{workspaceId}/images
ManagerWorkspaceImageController->>ManagerUpdateWorkspaceImages: execute(actor, workspaceId, request)
ManagerUpdateWorkspaceImages->>WorkspaceImageQueryRepository: findAllByWorkspaceId(workspaceId)
ManagerUpdateWorkspaceImages->>AttachFilesUseCase: execute(신규 fileIds, WORKSPACE_REPRESENTATIVE_IMAGE)
ManagerUpdateWorkspaceImages->>WorkspaceImageRepository: saveAll(정렬 갱신 + 신규 이미지)
ManagerUpdateWorkspaceImages->>FileDeleteService: delete(제거 대상 파일)
ManagerUpdateWorkspaceImages->>WorkspaceImageRepository: deleteAll(제거 대상 이미지)
ManagerUpdateWorkspaceImages-->>ManagerWorkspaceImageController: void
ManagerWorkspaceImageController-->>Client: 200 OK (empty)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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: 9
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/CreateWorkspaceRequest.java (1)
24-27: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winApplication 계층 유스케이스에
@Slf4j추가 필요코딩 가이드라인에 따르면
src/main/java/com/dreamteam/alter/application/**경로의 유스케이스는 로깅을 위해@Slf4j를 사용해야 합니다. 대표이미지 관련 주요 비즈니스 작업(생성, 승인 시 마이그레이션, 조회, 수정)에 로깅을 추가하면 운영 환경에서의 추적성과 문제 해결에 도움이 됩니다.
src/main/java/com/dreamteam/alter/application/workspace/usecase/CreateWorkspaceRequest.java#L24-L27: 클래스 선언부에@Slf4j추가 및 대표이미지 첨부 시점에log.info()권장src/main/java/com/dreamteam/alter/application/workspace/usecase/ApproveWorkspaceRequest.java#L36-L39: 클래스 선언부에@Slf4j추가 및 파일 누락 시log.warn()권장src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetWorkspaceImages.java#L25-L28: 클래스 선언부에@Slf4j추가 및 파일 필터링 시log.debug()권장src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateWorkspaceImages.java#L32-L35: 클래스 선언부에@Slf4j추가 및 삭제/추가 작업 시log.info()권장🤖 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/main/java/com/dreamteam/alter/application/workspace/usecase/CreateWorkspaceRequest.java` around lines 24 - 27, Add `@Slf4j` annotation to the class declarations in all four workspace usecase files to enable logging according to coding guidelines. In src/main/java/com/dreamteam/alter/application/workspace/usecase/CreateWorkspaceRequest.java (anchor site, lines 24-27), add `@Slf4j` above the class declaration and insert log.info() calls when attaching representative images. In src/main/java/com/dreamteam/alter/application/workspace/usecase/ApproveWorkspaceRequest.java (sibling site, lines 36-39), add `@Slf4j` to the class declaration and add log.warn() when files are missing during approval. In src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetWorkspaceImages.java (sibling site, lines 25-28), add `@Slf4j` to the class declaration and add log.debug() during file filtering operations. In src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateWorkspaceImages.java (sibling site, lines 32-35), add `@Slf4j` to the class declaration and add log.info() when performing delete and add operations on images.Source: Coding guidelines
src/main/java/com/dreamteam/alter/domain/workspace/entity/WorkspaceImage.java (1)
1-72:⚠️ Potential issue | 🔴 Critical | 🏗️ Heavy lift도메인 계층에 인프라 의존성이 존재합니다.
도메인 엔티티가 JPA 어노테이션(
@Entity,@Table,@ManyToOne,@Column등)과 Spring Data 어노테이션(@CreatedDate,@LastModifiedDate,AuditingEntityListener)을 사용하고 있습니다.코딩 가이드라인에 따르면 도메인 계층은 "ZERO infrastructure dependencies (no Spring, no JPA annotations, no external libs)"를 준수해야 합니다. 헥사고날 아키텍처에서는 도메인 엔티티가 순수 POJO여야 하며, 영속성 관심사는 어댑터 계층에 속합니다.
As per coding guidelines: "
src/main/java/com/dreamteam/alter/domain/**: ZERO infrastructure dependencies (no Spring, no JPA annotations, no external libs)."🤖 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/main/java/com/dreamteam/alter/domain/workspace/entity/WorkspaceImage.java` around lines 1 - 72, The WorkspaceImage class in the domain layer contains infrastructure dependencies through JPA annotations (`@Entity`, `@Table`, `@ManyToOne`, `@Column`, `@Id`, `@GeneratedValue`, `@JoinColumn`) and Spring Data annotations (`@CreatedDate`, `@LastModifiedDate`, `@EntityListeners`), which violates the requirement for ZERO infrastructure dependencies. Refactor by removing all JPA and Spring annotations from WorkspaceImage, converting it to a pure POJO domain entity with only the core properties (id, workspace, fileId, sortOrder, createdAt, updatedAt) and business methods (create factory method and updateSortOrder). Create a separate JPA persistence entity in the infrastructure layer that handles all database mapping concerns including the `@Entity` annotation, all column configurations, unique constraints, and auditing listeners, then use a mapper to convert between the domain entity and the JPA persistence entity.Source: Coding guidelines
🤖 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/dreamteam/alter/adapter/inbound/general/workspace/dto/CreateWorkspaceRequestDto.java`:
- Around line 71-73: The representativeImageFileIds list validation in both DTOs
is insufficient. In
src/main/java/com/dreamteam/alter/adapter/inbound/general/workspace/dto/CreateWorkspaceRequestDto.java
(lines 71-73), add element-level validation by changing the List declaration to
List<`@NotBlank` String> and add a constraint to prevent duplicate IDs (either via
validation annotation or use case-level validation). In
src/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/dto/UpdateWorkspaceImagesRequestDto.java
(lines 18-21), apply identical validation: change the representativeImageFileIds
field to List<`@NotBlank` String> and add the duplicate ID prevention constraint
to match the anchor site. This ensures consistent input contracts across both
DTOs and prevents conflicts during delete/add/reorder operations when the image
list is modified.
In
`@src/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/controller/ManagerWorkspaceImageController.java`:
- Around line 27-33: The ManagerWorkspaceImageController class is missing the
`@Getter` annotation, which violates the team's coding guidelines that require
controllers to use both `@Getter` and `@RequiredArgsConstructor`. Add the `@Getter`
annotation to the class-level annotations alongside the existing
`@RequiredArgsConstructor` annotation to ensure consistency with team standards.
- Around line 34-38: The code mixes `@RequiredArgsConstructor` constructor
injection with `@Resource` field injection, which causes bean name resolution to
fail because `@Resource` annotations are not processed by the constructor
generated by `@RequiredArgsConstructor`. In the ManagerWorkspaceImageController
class, replace the `@Resource` annotations on the managerGetWorkspaceImages and
managerUpdateWorkspaceImages fields with `@Autowired` annotations, and add
`@Qualifier` annotations with the corresponding bean names
(managerGetWorkspaceImages and managerUpdateWorkspaceImages respectively) to
ensure consistent field-based injection. This same pattern should be applied
across all adapter layer controller classes where this mixed injection approach
is currently used.
In
`@src/main/java/com/dreamteam/alter/application/workspace/usecase/ApproveWorkspaceRequest.java`:
- Around line 86-111: The attachRepresentativeImages method in the
ApproveWorkspaceRequest class silently skips missing files when they are not
found in the fileMap, which can hide data integrity issues if files are deleted
between request submission and approval. Add `@Slf4j` annotation to the
ApproveWorkspaceRequest class, then add a warning log statement in the
null-check condition (the if block that currently just continues when file is
null) to log which file ID is missing from the workspace request ID, so
operations teams can detect when not all requested images are migrated during
workspace approval.
In
`@src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateWorkspaceImages.java`:
- Around line 58-60: The authorization validation logic in the
ManagerUpdateWorkspaceImages class (the Objects.equals check comparing workspace
manager IDs) should be extracted into a separate, dedicated method to improve
code clarity and intent. Create a new private method (e.g.,
validateWorkspaceOwnership or validateManagerAuthorization) that contains the
authorization check at lines 58-60, then call this new method from the
appropriate location in the use case logic. This makes it explicit that the code
is performing an authorization check rather than simply verifying workspace
existence.
In
`@src/main/java/com/dreamteam/alter/domain/workspace/entity/WorkspaceImage.java`:
- Line 1: The WorkspaceImage and WorkspaceRequestImage classes in the domain
layer currently violate hexagonal architecture principles by including JPA
annotations (`@Entity`, `@Table`, `@ManyToOne`, `@Column`) and Spring Data annotations
(`@CreatedDate`, `@LastModifiedDate`, AuditingEntityListener). Remove all
infrastructure-specific annotations from these domain entity classes to make
them pure POJOs with zero external dependencies. Create corresponding JPA entity
classes in the adapter/infrastructure layer instead, and implement a mapping
layer to convert between domain models and JPA entities for database
persistence.
- Around line 68-70: The updateSortOrder method in the WorkspaceImage class is
missing validation to ensure the sortOrder parameter is not negative. Add a
validation check at the beginning of the updateSortOrder method to verify that
the sortOrder parameter is greater than or equal to 0. If a negative value is
provided, throw an appropriate exception (such as IllegalArgumentException) with
a descriptive message explaining that sortOrder must be non-negative.
In
`@src/main/java/com/dreamteam/alter/domain/workspace/entity/WorkspaceRequestImage.java`:
- Around line 1-67: The `WorkspaceRequestImage` class contains JPA annotations
(`@Entity`, `@Table`, `@ManyToOne`, `@Column`) and Spring Data annotations
(`@CreatedDate`, `@LastModifiedDate`, `AuditingEntityListener`) in the domain
layer, violating the requirement for ZERO infrastructure dependencies. Remove
all JPA and Spring annotations from the `WorkspaceRequestImage` class and
convert it to a plain POJO containing only the core business logic and data
fields. Create a corresponding JPA entity in the persistence/infrastructure
layer (typically in a `persistence` or `infrastructure` package) that includes
all the annotations and handles the database mapping, keeping the domain entity
purely focused on business rules without any framework dependencies.
In
`@src/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerGetWorkspaceImagesUseCase.java`:
- Around line 5-9: The ManagerGetWorkspaceImagesUseCase interface violates
layering by directly importing and using WorkspaceImageResponseDto from the
adapter.inbound package. Domain ports must not depend on adapter DTOs. Create a
domain or application layer response model (such as a WorkspaceImageResult or
similar query result class) in an appropriate package within the domain or
application layer, remove the import of WorkspaceImageResponseDto from the
adapter package, and update the return type of the execute method to use this
new domain-level model instead. The adapter layer will then map from this domain
model to WorkspaceImageResponseDto when needed.
---
Outside diff comments:
In
`@src/main/java/com/dreamteam/alter/application/workspace/usecase/CreateWorkspaceRequest.java`:
- Around line 24-27: Add `@Slf4j` annotation to the class declarations in all four
workspace usecase files to enable logging according to coding guidelines. In
src/main/java/com/dreamteam/alter/application/workspace/usecase/CreateWorkspaceRequest.java
(anchor site, lines 24-27), add `@Slf4j` above the class declaration and insert
log.info() calls when attaching representative images. In
src/main/java/com/dreamteam/alter/application/workspace/usecase/ApproveWorkspaceRequest.java
(sibling site, lines 36-39), add `@Slf4j` to the class declaration and add
log.warn() when files are missing during approval. In
src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetWorkspaceImages.java
(sibling site, lines 25-28), add `@Slf4j` to the class declaration and add
log.debug() during file filtering operations. In
src/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateWorkspaceImages.java
(sibling site, lines 32-35), add `@Slf4j` to the class declaration and add
log.info() when performing delete and add operations on images.
In
`@src/main/java/com/dreamteam/alter/domain/workspace/entity/WorkspaceImage.java`:
- Around line 1-72: The WorkspaceImage class in the domain layer contains
infrastructure dependencies through JPA annotations (`@Entity`, `@Table`,
`@ManyToOne`, `@Column`, `@Id`, `@GeneratedValue`, `@JoinColumn`) and Spring Data
annotations (`@CreatedDate`, `@LastModifiedDate`, `@EntityListeners`), which violates
the requirement for ZERO infrastructure dependencies. Refactor by removing all
JPA and Spring annotations from WorkspaceImage, converting it to a pure POJO
domain entity with only the core properties (id, workspace, fileId, sortOrder,
createdAt, updatedAt) and business methods (create factory method and
updateSortOrder). Create a separate JPA persistence entity in the infrastructure
layer that handles all database mapping concerns including the `@Entity`
annotation, all column configurations, unique constraints, and auditing
listeners, then use a mapper to convert between the domain entity and the JPA
persistence entity.
🪄 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: f0595dc9-c986-4c16-af2b-adfa57b7defa
📒 Files selected for processing (27)
src/main/java/com/dreamteam/alter/adapter/inbound/general/workspace/dto/CreateWorkspaceRequestDto.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/controller/ManagerWorkspaceImageController.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/controller/ManagerWorkspaceImageControllerSpec.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/dto/ManagerWorkspaceResponseDto.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/dto/UpdateWorkspaceImagesRequestDto.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/dto/WorkspaceImageResponseDto.javasrc/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceImageJpaRepository.javasrc/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceImageQueryRepositoryImpl.javasrc/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceImageRepositoryImpl.javasrc/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceRequestImageJpaRepository.javasrc/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceRequestImageQueryRepositoryImpl.javasrc/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceRequestImageRepositoryImpl.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ApproveWorkspaceRequest.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/CreateWorkspaceRequest.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetWorkspace.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetWorkspaceImages.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateWorkspaceImages.javasrc/main/java/com/dreamteam/alter/common/exception/ErrorCode.javasrc/main/java/com/dreamteam/alter/domain/file/type/FileTargetType.javasrc/main/java/com/dreamteam/alter/domain/workspace/entity/WorkspaceImage.javasrc/main/java/com/dreamteam/alter/domain/workspace/entity/WorkspaceRequestImage.javasrc/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerGetWorkspaceImagesUseCase.javasrc/main/java/com/dreamteam/alter/domain/workspace/port/inbound/ManagerUpdateWorkspaceImagesUseCase.javasrc/main/java/com/dreamteam/alter/domain/workspace/port/outbound/WorkspaceImageQueryRepository.javasrc/main/java/com/dreamteam/alter/domain/workspace/port/outbound/WorkspaceImageRepository.javasrc/main/java/com/dreamteam/alter/domain/workspace/port/outbound/WorkspaceRequestImageQueryRepository.javasrc/main/java/com/dreamteam/alter/domain/workspace/port/outbound/WorkspaceRequestImageRepository.java
|
흠... |
There was a problem hiding this comment.
Actionable comments posted: 6
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/domain/workspace/entity/WorkspaceRequestImage.java (1)
56-61:⚠️ Potential issue | 🟡 Minor | ⚡ Quick win
create()에서sortOrder불변식 검증이 빠져 있습니다.
WorkspaceImage는 Line 59-76에서 음수 정렬값을 차단하지만, 여기서는sortOrder가 그대로 저장됩니다. 도메인 엔티티 간 불변식이 불일치하면 이후 정렬/조회 계약이 깨질 수 있습니다.
As per coding guidelines, "src/main/java/com/dreamteam/alter/domain/**: Entities encapsulate business rules and invariants."🔧 제안 수정안
public static WorkspaceRequestImage create(WorkspaceRequest workspaceRequest, String fileId, int sortOrder) { + validateSortOrder(sortOrder); return WorkspaceRequestImage.builder() .workspaceRequest(workspaceRequest) .fileId(fileId) .sortOrder(sortOrder) .build(); } + +private static void validateSortOrder(int sortOrder) { + if (sortOrder < 0) { + throw new CustomException(ErrorCode.ILLEGAL_ARGUMENT, "노출 순서는 0 이상이어야 합니다."); + } +}🤖 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/main/java/com/dreamteam/alter/domain/workspace/entity/WorkspaceRequestImage.java` around lines 56 - 61, The create() method in the WorkspaceRequestImage class is missing validation for the sortOrder parameter to ensure it is not negative, which creates an inconsistency with the WorkspaceImage entity that enforces this invariant. Add validation logic in the create() method to check that sortOrder is non-negative before building the WorkspaceRequestImage object, ensuring all domain entities maintain consistent business rule enforcement as per the guideline that entities should encapsulate business rules and invariants.Source: Coding guidelines
src/main/java/com/dreamteam/alter/application/workspace/usecase/ApproveWorkspaceRequest.java (1)
89-100:⚠️ Potential issue | 🟡 Minor포트 인터페이스에 정렬 계약을 명시하세요.
현재 코드는 정렬된 결과를 보장합니다: 어댑터의 JPA 리포지토리 메서드
findByWorkspaceRequestIdOrderBySortOrderAsc()가 명시적으로 오름차순 정렬을 수행합니다.하지만 포트 인터페이스
WorkspaceRequestImageQueryRepository.findAllByWorkspaceRequestId()는 정렬을 보장하는 메서드명을 사용하지 않습니다. 다른 개발자가 이 포트를 구현할 때 정렬 요구사항을 놓칠 수 있습니다.attachRepresentativeImages메서드는 이 정렬 순서에 직접 의존하므로, 포트 계약이 더 명확해야 합니다.수정 제안:
- 포트 메서드명을
findAllByWorkspaceRequestIdOrderBySortOrderAsc()로 변경하거나- 포트 인터페이스의 메서드에 JavaDoc을 추가하여 정렬 순서를 명시 (
@return sort_order 오름차순으로 정렬된 이미지 목록)🤖 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/main/java/com/dreamteam/alter/application/workspace/usecase/ApproveWorkspaceRequest.java` around lines 89 - 100, The port interface WorkspaceRequestImageQueryRepository.findAllByWorkspaceRequestId() does not explicitly specify that results are sorted by sort_order in ascending order, even though the attachRepresentativeImages method depends on this ordering. Make the sorting contract explicit in the port interface either by renaming the method to findAllByWorkspaceRequestIdOrderBySortOrderAsc() to match the implementation, or by adding a JavaDoc comment to the existing method that clearly documents that the returned list is sorted in ascending order by sort_order. This ensures other developers implementing this port will understand the sorting requirement.
🤖 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/dreamteam/alter/application/workspace/usecase/CreateWorkspaceRequest.java`:
- Around line 59-61: The CreateWorkspaceRequest use case is missing validation
to enforce the maximum 5-image limit for representative images. After extracting
representativeImageFileIds using
WorkspaceImageRequestDto.toOrderedFileIds(request.getRepresentativeImages()),
add a check to validate that the list size does not exceed 5 images, and throw
an appropriate validation exception if the limit is exceeded, consistent with
how this validation is handled in the admin replacement use case.
In
`@src/test/java/com/dreamteam/alter/application/workspace/usecase/ApproveWorkspaceRequestTest.java`:
- Line 39: The test class ApproveWorkspaceRequestTest does not follow the
project's naming convention which requires test classes to use the plural form
[ClassName]Tests.java. Rename the class from ApproveWorkspaceRequestTest to
ApproveWorkspaceRequestTests and update the file name accordingly from
ApproveWorkspaceRequestTest.java to ApproveWorkspaceRequestTests.java to comply
with the coding guidelines for test classes in src/test/**.
In
`@src/test/java/com/dreamteam/alter/application/workspace/usecase/CreateWorkspaceRequestTest.java`:
- Line 34: The test class CreateWorkspaceRequestTest does not follow the
project's naming convention which requires test classes to use the plural
"Tests" suffix. Rename the class from CreateWorkspaceRequestTest to
CreateWorkspaceRequestTests and update the file name from
CreateWorkspaceRequestTest.java to CreateWorkspaceRequestTests.java to comply
with the coding guidelines.
In
`@src/test/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetWorkspaceImagesTest.java`:
- Line 31: The test class and file name do not follow the required naming
convention for test classes. Rename both the file from
`ManagerGetWorkspaceImagesTest.java` to `ManagerGetWorkspaceImagesTests.java`
(note the plural "Tests") and update the class name from
`ManagerGetWorkspaceImagesTest` to `ManagerGetWorkspaceImagesTests` to comply
with the coding guideline that test classes in `src/test/**` should follow the
pattern `[ClassName]Tests.java` with a plural "Tests" suffix.
In
`@src/test/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateWorkspaceImagesTest.java`:
- Line 44: The test class name violates the team's naming convention which
requires test classes to use the pattern [ClassName]Tests.java with a plural
"Tests" suffix. Rename the class ManagerUpdateWorkspaceImagesTest to
ManagerUpdateWorkspaceImagesTests and rename the corresponding file from
ManagerUpdateWorkspaceImagesTest.java to ManagerUpdateWorkspaceImagesTests.java
to comply with the coding guidelines.
In
`@src/test/java/com/dreamteam/alter/domain/workspace/entity/WorkspaceImageTest.java`:
- Around line 13-56: Rename the test class from WorkspaceImageTest to
WorkspaceImageTests (plural form) to align with team conventions. Then update
all four test methods to follow the action_condition_expectedResult naming
pattern: rename create_정상 to create_validSortOrder_createsSuccessfully,
create_음수sortOrder_예외 to
create_negativeSortOrder_throwsIllegalArgumentException, updateSortOrder_정상 to
updateSortOrder_validValue_updatesSuccessfully, and updateSortOrder_음수_예외 to
updateSortOrder_negativeValue_throwsIllegalArgumentException. Finally, replace
the informal when/then comment style with explicit section comments: add a given
comment above the setup code, change when to when, and ensure then appears
before assertions, making the Given-When-Then pattern clearly visible throughout
all test methods.
---
Outside diff comments:
In
`@src/main/java/com/dreamteam/alter/application/workspace/usecase/ApproveWorkspaceRequest.java`:
- Around line 89-100: The port interface
WorkspaceRequestImageQueryRepository.findAllByWorkspaceRequestId() does not
explicitly specify that results are sorted by sort_order in ascending order,
even though the attachRepresentativeImages method depends on this ordering. Make
the sorting contract explicit in the port interface either by renaming the
method to findAllByWorkspaceRequestIdOrderBySortOrderAsc() to match the
implementation, or by adding a JavaDoc comment to the existing method that
clearly documents that the returned list is sorted in ascending order by
sort_order. This ensures other developers implementing this port will understand
the sorting requirement.
In
`@src/main/java/com/dreamteam/alter/domain/workspace/entity/WorkspaceRequestImage.java`:
- Around line 56-61: The create() method in the WorkspaceRequestImage class is
missing validation for the sortOrder parameter to ensure it is not negative,
which creates an inconsistency with the WorkspaceImage entity that enforces this
invariant. Add validation logic in the create() method to check that sortOrder
is non-negative before building the WorkspaceRequestImage object, ensuring all
domain entities maintain consistent business rule enforcement as per the
guideline that entities should encapsulate business rules and invariants.
🪄 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: 0acc0242-f98a-4ea8-b0ec-a7c640c5006b
📒 Files selected for processing (18)
src/main/java/com/dreamteam/alter/adapter/inbound/common/dto/WorkspaceImageRequestDto.javasrc/main/java/com/dreamteam/alter/adapter/inbound/general/workspace/dto/CreateWorkspaceRequestDto.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/controller/ManagerWorkspaceImageControllerSpec.javasrc/main/java/com/dreamteam/alter/adapter/inbound/manager/workspace/dto/UpdateWorkspaceImagesRequestDto.javasrc/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceImageJpaRepository.javasrc/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceImageQueryRepositoryImpl.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ApproveWorkspaceRequest.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/CreateWorkspaceRequest.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetWorkspaceImages.javasrc/main/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateWorkspaceImages.javasrc/main/java/com/dreamteam/alter/domain/workspace/entity/WorkspaceImage.javasrc/main/java/com/dreamteam/alter/domain/workspace/entity/WorkspaceRequestImage.javasrc/main/java/com/dreamteam/alter/domain/workspace/port/outbound/WorkspaceImageQueryRepository.javasrc/test/java/com/dreamteam/alter/application/workspace/usecase/ApproveWorkspaceRequestTest.javasrc/test/java/com/dreamteam/alter/application/workspace/usecase/CreateWorkspaceRequestTest.javasrc/test/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetWorkspaceImagesTest.javasrc/test/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateWorkspaceImagesTest.javasrc/test/java/com/dreamteam/alter/domain/workspace/entity/WorkspaceImageTest.java
💤 Files with no reviewable changes (3)
- src/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceImageJpaRepository.java
- src/main/java/com/dreamteam/alter/adapter/outbound/workspace/persistence/WorkspaceImageQueryRepositoryImpl.java
- src/main/java/com/dreamteam/alter/domain/workspace/port/outbound/WorkspaceImageQueryRepository.java
ysw789
left a comment
There was a problem hiding this comment.
ManagerGetWorkspace.java 에서 중복 소유 검증 하는 부분만 체크해보고, 통합 테스트 후 문제 없으면 병합하면 될 것 같습니다
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (8)
src/test/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateWorkspaceImagesTests.java (2)
82-92:⚠️ Potential issue | 🟠 Major | ⚡ Quick win개수 초과 예외 기대값을
FILE_LIMIT_EXCEEDED계약과 일치시켜 주세요.Line 91에서 5개 초과 케이스를
ILLEGAL_ARGUMENT로 검증하고 있습니다. PR 목표의 에러 계약(FILE_LIMIT_EXCEEDED)과 맞추지 않으면 테스트가 잘못된 기준을 고정합니다.🤖 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/dreamteam/alter/application/workspace/usecase/ManagerUpdateWorkspaceImagesTests.java` around lines 82 - 92, In the test method execute_5개초과_예외, update the error code assertion to align with the PR's error handling contract. Change the assertion from .isEqualTo(ErrorCode.ILLEGAL_ARGUMENT) to .isEqualTo(ErrorCode.FILE_LIMIT_EXCEEDED) so that the test verifies the correct expected exception type when workspace images exceed the 5-file limit.
81-208:⚠️ Potential issue | 🟡 Minor | ⚡ Quick win업데이트 유스케이스 테스트의 메서드명/시나리오 그룹을 가이드 형식으로 맞춰주세요.
Line 83 이하 테스트명들이
action_condition_expectedResult패턴을 완전하게 따르지 않고, 검증/권한/동기화 시나리오도@Nested로 구분되어 있지 않습니다.
As per coding guidelines,src/test/**는 “Test methods use descriptive names: action_condition_expectedResult.” 및 “@nested classes group related tests with@DisplayName.”를 준수해야 합니다.🤖 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/dreamteam/alter/application/workspace/usecase/ManagerUpdateWorkspaceImagesTests.java` around lines 81 - 208, Refactor the ManagerUpdateWorkspaceImagesTests class to follow the action_condition_expectedResult naming pattern consistently and organize related test scenarios using `@Nested` classes. Create separate `@Nested` classes for different test categories (such as validation scenarios, authorization scenarios, success scenarios, and not-found scenarios), each with appropriate `@DisplayName` annotations. Then rename the test methods within each nested class to strictly follow the action_condition_expectedResult pattern, ensuring method names are in English and clearly describe the action (execute), condition (input or state), and expected result (exception type or behavior). Apply this refactoring to all test methods including execute_5개초과_예외, execute_업장없음_예외, execute_다른매니저_예외, execute_신규추가, execute_삭제및순서변경, and execute_중복제거.Source: Coding guidelines
src/test/java/com/dreamteam/alter/application/workspace/usecase/CreateWorkspaceRequestTests.java (2)
69-118:⚠️ Potential issue | 🟡 Minor | ⚡ Quick win테스트 메서드 네이밍과 그룹 구조를 가이드에 맞춰주세요.
Line 71/88 메서드명(
execute_대표이미지없음,execute_대표이미지중복제거)은action_condition_expectedResult형식이 완전하지 않고, 관련 시나리오도@Nested로 묶여 있지 않습니다.
As per coding guidelines,src/test/**는 “Test methods use descriptive names: action_condition_expectedResult.” 및 “@nested classes group related tests with@DisplayName.”를 준수해야 합니다.🤖 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/dreamteam/alter/application/workspace/usecase/CreateWorkspaceRequestTests.java` around lines 69 - 118, The test methods `execute_대표이미지없음` and `execute_대표이미지중복제거` do not fully adhere to the `action_condition_expectedResult` naming convention and are not grouped in a `@Nested` class. Refactor by creating a `@Nested` class with an appropriate `@DisplayName` to group representative image related scenarios, then rename the test methods to follow the complete naming pattern where the method name clearly indicates the action, condition, and expected result in English or a consistent format as per the coding guidelines.Source: Coding guidelines
86-118: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win이미지 5개 초과 케이스를 명시적으로 테스트에 추가해주세요.
이번 변경의 핵심 규칙(최대 5개 제한)이 현재 테스트에는 없습니다. Line 86-118 인접 구간에 초과 입력 시 예외 코드와 부수효과 미발생(
attachFiles,saveAll미호출)까지 검증하는 케이스를 추가하는 게 안전합니다.🤖 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/dreamteam/alter/application/workspace/usecase/CreateWorkspaceRequestTests.java` around lines 86 - 118, Add a new test method after the execute_대표이미지중복제거 test that explicitly validates the maximum 5 image limit constraint. In this new test, create a CreateWorkspaceRequestDto with more than 5 WorkspaceImageRequestDto objects in the representative images set, then verify that calling createWorkspaceRequest.execute(user, dto) throws the expected exception and that the side effects (attachFiles.execute and workspaceRequestImageRepository.saveAll) are never invoked. This ensures the 5-image limit is properly enforced at the boundary condition.src/test/java/com/dreamteam/alter/domain/workspace/entity/WorkspaceImageTests.java (1)
15-56:⚠️ Potential issue | 🟡 Minor | ⚡ Quick win
@Nested로 시나리오를 그룹화해 테스트 구조를 맞춰주세요.Line 15-56은
create와updateSortOrder시나리오가 분리 가능한데 단일 클래스에 평면적으로 배치되어 있습니다.@Nested+@DisplayName으로 그룹화하면 유지보수성과 탐색성이 좋아집니다.
As per coding guidelines,src/test/**는 “@nested classes group related tests with@DisplayName.”를 준수해야 합니다.🤖 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/dreamteam/alter/domain/workspace/entity/WorkspaceImageTests.java` around lines 15 - 56, The test class in WorkspaceImageTests.java has four test methods that are currently flat-structured but should be grouped by functionality. Create two `@Nested` inner classes: one to group the create-related tests (create_validSortOrder_createsSuccessfully and create_negativeSortOrder_throwsIllegalArgumentException) and another to group the updateSortOrder-related tests (updateSortOrder_validValue_updatesSuccessfully and updateSortOrder_negativeValue_throwsIllegalArgumentException). Each `@Nested` class should have appropriate `@DisplayName` annotations describing the scenario group, and move the corresponding test methods into their respective nested classes while keeping their individual `@DisplayName` annotations intact.Source: Coding guidelines
src/test/java/com/dreamteam/alter/application/workspace/usecase/ApproveWorkspaceRequestTests.java (2)
87-153:⚠️ Potential issue | 🟡 Minor | ⚡ Quick win테스트 메서드명/그룹 구조를 가이드 형식으로 정리해주세요.
Line 89/104/132 메서드명이
action_condition_expectedResult패턴을 충분히 표현하지 않고, 승인 시나리오들도@Nested로 분리되지 않았습니다.
As per coding guidelines,src/test/**는 “Test methods use descriptive names: action_condition_expectedResult.” 및 “@nested classes group related tests with@DisplayName.”를 준수해야 합니다.🤖 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/dreamteam/alter/application/workspace/usecase/ApproveWorkspaceRequestTests.java` around lines 87 - 153, The test methods `execute_대표이미지없음()`, `execute_대표이미지마이그레이션()`, and `execute_일부파일누락()` do not fully follow the action_condition_expectedResult naming pattern as required by guidelines. Refactor the test structure by creating `@Nested` classes to group related test scenarios, then rename each test method to explicitly express the expected result in addition to the condition. For example, instead of `execute_대표이미지없음()`, rename it to something like `execute_shouldNotSaveWorkspaceImage_whenNoRepresentativeImage()` to clearly separate the action, condition, and expected result parts of the test.Source: Coding guidelines
81-128: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win정렬 순서 ‘마이그레이션’ 자체를 검증하는 케이스를 추가해주세요.
현재는
WorkspaceRequestImage의 실제sortOrder값을 모델링하지 않아, 승인 시 순서가 원본 정렬값 기준으로 이전되는지 검증되지 않습니다.requestImage헬퍼에 sortOrder를 주입하고(예: 2, 10), 기대 순서가 요구사항과 일치하는지 검증하는 테스트를 추가하는 게 좋습니다.🤖 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/dreamteam/alter/application/workspace/usecase/ApproveWorkspaceRequestTests.java` around lines 81 - 128, The current test execute_대표이미지마이그레이션 does not actually validate that the original sortOrder values from WorkspaceRequestImage are preserved during migration. Modify the requestImage helper method to accept a sortOrder parameter and configure the mock to return it when getSortOrder is called. Then add a new test case that creates requestImage mocks with distinct sortOrder values (for example, 2 and 10) instead of relying on defaults, set these mocks as the returned list from workspaceRequestImageQueryRepository, and verify that the saved WorkspaceImage objects in workspaceImageRepository.saveAll contain those exact original sortOrder values to ensure the migration preserves the source order correctly.src/test/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetWorkspaceImagesTests.java (1)
48-121:⚠️ Potential issue | 🟡 Minor | ⚡ Quick win조회 유스케이스 테스트도 네이밍/중첩 구조를 가이드에 맞춰주세요.
Line 50/65/82 메서드명은
action_condition_expectedResult형식이 충분히 드러나지 않고, 권한/빈목록/정상흐름 시나리오도@Nested로 분리되어 있지 않습니다.
As per coding guidelines,src/test/**는 “Test methods use descriptive names: action_condition_expectedResult.” 및 “@nested classes group related tests with@DisplayName.”를 준수해야 합니다.🤖 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/dreamteam/alter/application/workspace/usecase/ManagerGetWorkspaceImagesTests.java` around lines 48 - 121, Refactor the test class ManagerGetWorkspaceImagesTests to follow the coding guidelines by restructuring it with `@Nested` classes and updating method naming conventions. Create three `@Nested` classes to group related test scenarios: one for authorization checks containing execute_관리업장아님_예외, one for empty results containing execute_이미지없음_빈목록, and one for normal flow containing execute_정상_순서매핑. Rename each test method to more clearly follow the action_condition_expectedResult format using English naming (e.g., execute_whenNotManagedWorkspace_throwsWorkspaceNotFoundException, execute_whenNoImages_returnsEmptyList, execute_whenImagesExist_mapsAndRecalculatesSortOrder). Add `@DisplayName` annotations to each `@Nested` class to describe the grouped test scenarios.Source: Coding guidelines
🤖 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/dreamteam/alter/application/workspace/usecase/CreateWorkspaceRequest.java`:
- Around line 11-12: The CreateWorkspaceRequest use case class in the
application layer has a direct dependency on WorkspaceImageRequestDto from the
adapter layer, which violates clean architecture principles that prohibit
infrastructure dependencies in the application layer. Remove the import
statement for WorkspaceImageRequestDto from
com.dreamteam.alter.adapter.inbound.common.dto, and instead create an internal
domain model or DTO within the application layer to represent image request
data. Update lines 63-64 where WorkspaceImageRequestDto is used to work with the
new internal model, or move the conversion logic to a dedicated utility class or
domain port interface that bridges the gap between the adapter input and the use
case's internal representation.
- Around line 65-67: The image count validation in the CreateWorkspaceRequest
class is throwing CustomException with ErrorCode.ILLEGAL_ARGUMENT when the
representativeImageFileIds size exceeds MAX_IMAGE_COUNT, but this should be
aligned with the new error contract defined in this PR. Replace
ErrorCode.ILLEGAL_ARGUMENT with ErrorCode.FILE_LIMIT_EXCEEDED in the exception
thrown at line 66 to ensure consistent error handling across the client and
maintain the unified error contract for file limit violations.
---
Outside diff comments:
In
`@src/test/java/com/dreamteam/alter/application/workspace/usecase/ApproveWorkspaceRequestTests.java`:
- Around line 87-153: The test methods `execute_대표이미지없음()`,
`execute_대표이미지마이그레이션()`, and `execute_일부파일누락()` do not fully follow the
action_condition_expectedResult naming pattern as required by guidelines.
Refactor the test structure by creating `@Nested` classes to group related test
scenarios, then rename each test method to explicitly express the expected
result in addition to the condition. For example, instead of
`execute_대표이미지없음()`, rename it to something like
`execute_shouldNotSaveWorkspaceImage_whenNoRepresentativeImage()` to clearly
separate the action, condition, and expected result parts of the test.
- Around line 81-128: The current test execute_대표이미지마이그레이션 does not actually
validate that the original sortOrder values from WorkspaceRequestImage are
preserved during migration. Modify the requestImage helper method to accept a
sortOrder parameter and configure the mock to return it when getSortOrder is
called. Then add a new test case that creates requestImage mocks with distinct
sortOrder values (for example, 2 and 10) instead of relying on defaults, set
these mocks as the returned list from workspaceRequestImageQueryRepository, and
verify that the saved WorkspaceImage objects in workspaceImageRepository.saveAll
contain those exact original sortOrder values to ensure the migration preserves
the source order correctly.
In
`@src/test/java/com/dreamteam/alter/application/workspace/usecase/CreateWorkspaceRequestTests.java`:
- Around line 69-118: The test methods `execute_대표이미지없음` and `execute_대표이미지중복제거`
do not fully adhere to the `action_condition_expectedResult` naming convention
and are not grouped in a `@Nested` class. Refactor by creating a `@Nested` class
with an appropriate `@DisplayName` to group representative image related
scenarios, then rename the test methods to follow the complete naming pattern
where the method name clearly indicates the action, condition, and expected
result in English or a consistent format as per the coding guidelines.
- Around line 86-118: Add a new test method after the execute_대표이미지중복제거 test
that explicitly validates the maximum 5 image limit constraint. In this new
test, create a CreateWorkspaceRequestDto with more than 5
WorkspaceImageRequestDto objects in the representative images set, then verify
that calling createWorkspaceRequest.execute(user, dto) throws the expected
exception and that the side effects (attachFiles.execute and
workspaceRequestImageRepository.saveAll) are never invoked. This ensures the
5-image limit is properly enforced at the boundary condition.
In
`@src/test/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetWorkspaceImagesTests.java`:
- Around line 48-121: Refactor the test class ManagerGetWorkspaceImagesTests to
follow the coding guidelines by restructuring it with `@Nested` classes and
updating method naming conventions. Create three `@Nested` classes to group
related test scenarios: one for authorization checks containing
execute_관리업장아님_예외, one for empty results containing execute_이미지없음_빈목록, and one
for normal flow containing execute_정상_순서매핑. Rename each test method to more
clearly follow the action_condition_expectedResult format using English naming
(e.g., execute_whenNotManagedWorkspace_throwsWorkspaceNotFoundException,
execute_whenNoImages_returnsEmptyList,
execute_whenImagesExist_mapsAndRecalculatesSortOrder). Add `@DisplayName`
annotations to each `@Nested` class to describe the grouped test scenarios.
In
`@src/test/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateWorkspaceImagesTests.java`:
- Around line 82-92: In the test method execute_5개초과_예외, update the error code
assertion to align with the PR's error handling contract. Change the assertion
from .isEqualTo(ErrorCode.ILLEGAL_ARGUMENT) to
.isEqualTo(ErrorCode.FILE_LIMIT_EXCEEDED) so that the test verifies the correct
expected exception type when workspace images exceed the 5-file limit.
- Around line 81-208: Refactor the ManagerUpdateWorkspaceImagesTests class to
follow the action_condition_expectedResult naming pattern consistently and
organize related test scenarios using `@Nested` classes. Create separate `@Nested`
classes for different test categories (such as validation scenarios,
authorization scenarios, success scenarios, and not-found scenarios), each with
appropriate `@DisplayName` annotations. Then rename the test methods within each
nested class to strictly follow the action_condition_expectedResult pattern,
ensuring method names are in English and clearly describe the action (execute),
condition (input or state), and expected result (exception type or behavior).
Apply this refactoring to all test methods including execute_5개초과_예외,
execute_업장없음_예외, execute_다른매니저_예외, execute_신규추가, execute_삭제및순서변경, and
execute_중복제거.
In
`@src/test/java/com/dreamteam/alter/domain/workspace/entity/WorkspaceImageTests.java`:
- Around line 15-56: The test class in WorkspaceImageTests.java has four test
methods that are currently flat-structured but should be grouped by
functionality. Create two `@Nested` inner classes: one to group the create-related
tests (create_validSortOrder_createsSuccessfully and
create_negativeSortOrder_throwsIllegalArgumentException) and another to group
the updateSortOrder-related tests
(updateSortOrder_validValue_updatesSuccessfully and
updateSortOrder_negativeValue_throwsIllegalArgumentException). Each `@Nested`
class should have appropriate `@DisplayName` annotations describing the scenario
group, and move the corresponding test methods into their respective nested
classes while keeping their individual `@DisplayName` annotations intact.
🪄 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: dd9ad4e5-2464-410b-9cfb-738a32593b4a
📒 Files selected for processing (6)
src/main/java/com/dreamteam/alter/application/workspace/usecase/CreateWorkspaceRequest.javasrc/test/java/com/dreamteam/alter/application/workspace/usecase/ApproveWorkspaceRequestTests.javasrc/test/java/com/dreamteam/alter/application/workspace/usecase/CreateWorkspaceRequestTests.javasrc/test/java/com/dreamteam/alter/application/workspace/usecase/ManagerGetWorkspaceImagesTests.javasrc/test/java/com/dreamteam/alter/application/workspace/usecase/ManagerUpdateWorkspaceImagesTests.javasrc/test/java/com/dreamteam/alter/domain/workspace/entity/WorkspaceImageTests.java
대표이미지(최대 5개) 관리를 위한 기반 구조 추가. 순서 관리가 필요해 File과 별도로 WorkspaceImage(라이브 업장), WorkspaceRequestImage(신청 단계) 조인 엔티티를 도입. FileTargetType에 WORKSPACE_REPRESENTATIVE_IMAGE, ErrorCode에 FILE_LIMIT_EXCEEDED 추가.
신청 시 대표이미지 파일을 첨부하고 순서를 보관(requestId 기준). 승인 시 생성된 업장(workspaceId)으로 파일을 재첨부하고 WorkspaceImage로 순서를 그대로 옮김.
GET /manager/workspaces/{id}/images 목록 조회,
PUT /manager/workspaces/{id}/images 전체 교체(추가/삭제/순서변경 원자 처리).
전달 목록 순서가 노출 순서, 최대 5개 제한.
매니저 업장 상세 조회 시 대표이미지를 노출 순서대로 반환.
동일 fileId 중복 전달 시 WorkspaceImage 중복 생성으로 uk_workspace_images_workspace_file 제약 위반 발생. distinct()로 선제거.
File 누락분을 건너뛸 때 sortOrder에 빈 구간이 생기던 문제 수정. 조회/승인 시 노출 순서를 0부터 연속 재계산.
List<@notblank String>로 빈/공백 fileId 유입 차단.
호출처 없는 데드코드 제거 (port/impl/jpa).
코드 리뷰 반영. 매니저 수정 플로우와 동일하게 distinct 처리.
코드 리뷰 반영. sortOrder는 0 이상이어야 하는 불변식 보장.
코드 리뷰 반영. 신청~승인 사이 파일 삭제로 일부만 마이그레이션되는 상황을 운영팀이 인지하도록 log.warn 추가.
엔티티 sortOrder 검증, 매니저 조회/수정(전체교체), 신청 시 중복제거, 승인 시 마이그레이션 케이스 커버.
- S3 물리 삭제는 롤백 불가하므로 신규 파일 attach/검증 성공 이후 마지막 단계로 이동 - 신규 ErrorCode(FILE_LIMIT_EXCEEDED) 제거 후 기존 ILLEGAL_ARGUMENT 재활용
- List<String> → Set<WorkspaceImageRequestDto>로 변경, fileId 기준 중복 자동 제거 - 노출 순서를 목록 인덱스 대신 sortOrder 필드로 명시 (미지정 시 후순위) - 수정 시 S3 물리 삭제를 attach/검증 성공 이후 마지막 단계로 이동 (트랜잭션 정합성) - 신규 ErrorCode(FILE_LIMIT_EXCEEDED) 제거 후 기존 ILLEGAL_ARGUMENT 재활용
컨트롤러 검증을 우회한 호출에서도 비즈니스 규칙이 깨지지 않도록 관리자 교체 유스케이스와 동일하게 유스케이스 단계에서 상한을 강제
컨트롤러 검증을 우회한 호출에서도 비즈니스 규칙이 깨지지 않도록 관리자 교체 유스케이스와 동일하게 유스케이스 단계에서 상한을 강제
- 신규 테스트 5개 클래스/파일명을 [ClassName]Tests 규칙으로 변경 - WorkspaceImageTests 메서드명을 action_condition_expectedResult 스타일로 변경
상세 조회는 getByManagerUserAndId로 이미 소유를 검증하므로, 이미지 합성 단계의 소유 재검증(existsByIdAndManagerUser)을 생략하도록 검증 없는 조회 경로(getImagesWithoutOwnershipCheck)를 분리. 컨트롤러 직접 호출 경로는 기존 소유 검증을 유지.
대표이미지 fileId 정렬/추출 변환을 request DTO 내부 메서드로 캡슐화하여 CreateWorkspaceRequest·ManagerUpdateWorkspaceImages 유스케이스가 WorkspaceImageRequestDto(adapter/inbound)에 직접 결합되지 않도록 변경. 업장 신청 대표이미지 5개 상한 검증 테스트도 추가.
ApproveWorkspaceRequest→UpdateWorkspaceRequestStatus 리네임에 따라 옛 ApproveWorkspaceRequestTests의 대표이미지 마이그레이션 케이스를 UpdateWorkspaceRequestStatusTests로 이전하고, ACTIVATED 케이스에 누락된 stub을 보강.
* feat: 업장 대표이미지 엔티티 및 repository 추가
대표이미지(최대 5개) 관리를 위한 기반 구조 추가.
순서 관리가 필요해 File과 별도로 WorkspaceImage(라이브 업장),
WorkspaceRequestImage(신청 단계) 조인 엔티티를 도입.
FileTargetType에 WORKSPACE_REPRESENTATIVE_IMAGE, ErrorCode에 FILE_LIMIT_EXCEEDED 추가.
* feat: 업장 등록 신청/승인 시 대표이미지 처리
신청 시 대표이미지 파일을 첨부하고 순서를 보관(requestId 기준).
승인 시 생성된 업장(workspaceId)으로 파일을 재첨부하고
WorkspaceImage로 순서를 그대로 옮김.
* feat: 매니저 업장 대표이미지 조회/수정 API 추가
GET /manager/workspaces/{id}/images 목록 조회,
PUT /manager/workspaces/{id}/images 전체 교체(추가/삭제/순서변경 원자 처리).
전달 목록 순서가 노출 순서, 최대 5개 제한.
* feat: 업장 상세 조회 응답에 대표이미지 목록 추가
매니저 업장 상세 조회 시 대표이미지를 노출 순서대로 반환.
* fix: 대표이미지 수정 시 중복 fileId 제거
동일 fileId 중복 전달 시 WorkspaceImage 중복 생성으로
uk_workspace_images_workspace_file 제약 위반 발생. distinct()로 선제거.
* fix: 대표이미지 노출 순서(sortOrder) 연속성 보장
File 누락분을 건너뛸 때 sortOrder에 빈 구간이 생기던 문제 수정.
조회/승인 시 노출 순서를 0부터 연속 재계산.
* fix: 대표이미지 fileId 목록에 빈 문자열 검증 추가
List<@notblank String>로 빈/공백 fileId 유입 차단.
* chore: 미사용 countByWorkspaceId 제거
호출처 없는 데드코드 제거 (port/impl/jpa).
* fix: 업장 등록 신청 시 중복 대표이미지 ID 제거
코드 리뷰 반영. 매니저 수정 플로우와 동일하게 distinct 처리.
* fix: 대표이미지 노출 순서 음수 값 검증 추가
코드 리뷰 반영. sortOrder는 0 이상이어야 하는 불변식 보장.
* fix: 승인 시 대표이미지 파일 누락 경고 로그 추가
코드 리뷰 반영. 신청~승인 사이 파일 삭제로 일부만 마이그레이션되는
상황을 운영팀이 인지하도록 log.warn 추가.
* test: 업장 대표이미지 기능 테스트 추가
엔티티 sortOrder 검증, 매니저 조회/수정(전체교체),
신청 시 중복제거, 승인 시 마이그레이션 케이스 커버.
* refactor: 대표이미지 엔티티 UNIQUE 제약 코드 제거 (DDL 관리)
* fix: 대표이미지 수정 트랜잭션 정합성 개선 및 ErrorCode 재활용
- S3 물리 삭제는 롤백 불가하므로 신규 파일 attach/검증 성공 이후 마지막 단계로 이동
- 신규 ErrorCode(FILE_LIMIT_EXCEEDED) 제거 후 기존 ILLEGAL_ARGUMENT 재활용
* fix: 대표이미지 조회 시 파일 누락 경고 로그 추가
* refactor: 대표이미지 요청을 {fileId, sortOrder} 구조로 변경
-
List<String> → Set<WorkspaceImageRequestDto>로 변경, fileId 기준 중복 자동 제거
- 노출
순서를 목록 인덱스 대신 sortOrder 필드로 명시 (미지정 시 후순위)
- 수정 시 S3 물리
삭제를 attach/검증 성공 이후 마지막 단계로 이동 (트랜잭션 정합성)
- 신규
ErrorCode(FILE_LIMIT_EXCEEDED) 제거 후 기존 ILLEGAL_ARGUMENT 재활용
* fix: 업장 신청 시 대표이미지 최대 5개 상한 검증 추가
컨트롤러 검증을 우회한 호출에서도 비즈니스 규칙이 깨지지 않도록
관리자 교체 유스케이스와 동일하게 유스케이스 단계에서 상한을 강제
* fix: 업장 신청 시 대표이미지 최대 5개 상한 검증 추가
컨트롤러 검증을 우회한 호출에서도 비즈니스 규칙이 깨지지 않도록
관리자 교체 유스케이스와 동일하게 유스케이스 단계에서 상한을 강제
* test: 테스트 클래스명 Tests 규칙 통일 및 메서드명 영문화
- 신규 테스트 5개 클래스/파일명을 [ClassName]Tests 규칙으로 변경
- WorkspaceImageTests 메서드명을 action_condition_expectedResult 스타일로 변경
* refactor: 업장 상세 조회 시 대표이미지 소유 검증 중복 제거
상세 조회는 getByManagerUserAndId로 이미 소유를 검증하므로,
이미지 합성 단계의 소유 재검증(existsByIdAndManagerUser)을 생략하도록
검증 없는 조회 경로(getImagesWithoutOwnershipCheck)를 분리.
컨트롤러 직접 호출 경로는 기존 소유 검증을 유지.
* refactor: 유스케이스의 어댑터 DTO 직접 의존 제거
대표이미지 fileId 정렬/추출 변환을 request DTO 내부 메서드로 캡슐화하여
CreateWorkspaceRequest·ManagerUpdateWorkspaceImages 유스케이스가
WorkspaceImageRequestDto(adapter/inbound)에 직접 결합되지 않도록 변경.
업장 신청 대표이미지 5개 상한 검증 테스트도 추가.
* test: dev 리네임에 맞춰 승인 대표이미지 테스트를 UpdateWorkspaceRequestStatusTests로 통합
ApproveWorkspaceRequest→UpdateWorkspaceRequestStatus 리네임에 따라
옛 ApproveWorkspaceRequestTests의 대표이미지 마이그레이션 케이스를
UpdateWorkspaceRequestStatusTests로 이전하고, ACTIVATED 케이스에
누락된 stub을 보강.
관련 문서
https://app.notion.com/p/BE-5-38086553162880baab73d11e16837e09?source=copy_link
개요
업장 등록 시 대표이미지(구직자 노출용)를 등록·관리하는 기능 추가. 업장당 최대 5개, 노출 순서 관리 지원.
설계 요약
순서 관리가 필요해 polymorphic
File만으로는 부족(sortOrder 없음).File은 S3 객체 보관/생명주기 그대로 재사용하고, 순서·업장연결을 담당하는 전용 조인 엔티티를 도입.
WorkspaceImage— 라이브 업장용, 순서 authorityWorkspaceRequestImage— 신청 단계 순서 보관 (승인 시점엔 workspaceId가 없어 별도 보관)변경 사항
기반
FileTargetType.WORKSPACE_REPRESENTATIVE_IMAGE,ErrorCode.FILE_LIMIT_EXCEEDED(B026) 추가WorkspaceImage,WorkspaceRequestImage엔티티 + Repository/QueryRepository신청/승인 플로우
CreateWorkspaceRequestDto.representativeImageFileIds(최대 5) 첨부 + 순서 보관(requestId 기준)WorkspaceImage로 순서 이관매니저 관리 API
GET /manager/workspaces/{id}/images— 노출 순서대로 목록 조회PUT /manager/workspaces/{id}/images— 전체 교체(추가/삭제/순서변경 원자 처리), 최대 5개상세 조회
representativeImages노출DB 마이그레이션
workspace_images(workspace_id FK, file_id, sort_order, created_at, updated_at, UNIQUE(workspace_id, file_id))workspace_request_images(workspace_request_id FK, file_id, sort_order, created_at, updated_at, UNIQUE(workspace_request_id,file_id))
미포함 (후속)
PostingDetailWorkspaceResponseDto미변경테스트
./gradlew compileJava통과Summary by CodeRabbit
Release Notes
New Features
Tests