Skip to content

feat: 프로젝트 basic CRUD 구성 - #16

Merged
sangwon02 merged 8 commits into
developfrom
feat/project-basic-crud
Jul 15, 2026
Merged

feat: 프로젝트 basic CRUD 구성#16
sangwon02 merged 8 commits into
developfrom
feat/project-basic-crud

Conversation

@chazy-d

@chazy-d chazy-d commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

🔗 관련 이슈 (Related Issue)

  • 없음

📝 작업 내용

이번 PR에서는 프로젝트 생성, 목록 조회, 상세 조회, 수정, 삭제를 처리하기 위한 기본 CRUD 구조를 추가했습니다.
프로젝트 도메인 메서드, 요청/응답 DTO, Converter, Repository, Service, Controller를 연결하여 프로젝트 파트 개발을 시작할 수 있는 기본 흐름을 구성했습니다.

주요 검토 파일

프로젝트 API

  • src/main/java/com/slatto/domain/project/controller/ProjectController.java - 프로젝트 기본 CRUD 엔드포인트 추가
  • src/main/java/com/slatto/domain/project/service/ProjectService.java - 프로젝트 생성/목록/상세/수정/삭제 비즈니스 로직 추가

프로젝트 DTO / Converter

  • src/main/java/com/slatto/domain/project/dto/ProjectCreateRequest.java - 프로젝트 생성 요청 DTO 추가
  • src/main/java/com/slatto/domain/project/dto/ProjectUpdateRequest.java - 프로젝트 수정 요청 DTO 추가
  • src/main/java/com/slatto/domain/project/dto/ProjectResponse.java - 프로젝트 기본 응답 DTO 추가
  • src/main/java/com/slatto/domain/project/dto/ProjectListResponse.java - 프로젝트 목록 응답 DTO 추가
  • src/main/java/com/slatto/domain/project/dto/ProjectDetailResponse.java - 프로젝트 상세 응답 DTO 추가
  • src/main/java/com/slatto/domain/project/converter/ProjectConverter.java - Entity/DTO 변환 로직 추가

프로젝트 도메인 / Repository

  • src/main/java/com/slatto/domain/project/entity/Project.java - 프로젝트 생성/수정/상태 변경/삭제 도메인 메서드 추가
  • src/main/java/com/slatto/domain/project/entity/ProjectMember.java - 프로젝트 멤버 생성/권한 확인/탈퇴 도메인 메서드 추가
  • src/main/java/com/slatto/domain/project/entity/ProjectUserRole.java - 프로젝트 내 역할 생성 메서드 추가
  • src/main/java/com/slatto/domain/project/repository/ProjectRepository.java - 프로젝트 조회 및 생성 개수 조회 메서드 추가
  • src/main/java/com/slatto/domain/project/repository/ProjectMemberRepository.java - 프로젝트 멤버 조회, 목록 조회, 멤버 미리보기 조회 메서드 추가
  • src/main/java/com/slatto/domain/project/repository/ProjectUserRoleRepository.java - 프로젝트 역할 조회 메서드 추가
  • src/main/java/com/slatto/domain/user/repository/UserRepository.java - 삭제되지 않은 사용자 조회 메서드 추가

프로젝트 예외

  • src/main/java/com/slatto/domain/project/exception/ProjectErrorCode.java - 프로젝트 도메인 에러 코드 추가

1. 프로젝트 생성 기능 추가

로그인한 사용자가 프로젝트를 생성할 수 있도록 기본 생성 흐름을 추가했습니다.

  • 프로젝트 생성
  • 생성자를 프로젝트 멤버로 등록
  • 생성자 권한을 ADMIN으로 설정
  • 생성자가 선택한 역할을 ProjectUserRole로 저장
  • 무료 계정 프로젝트 생성 제한 5개 적용

무료 계정은 최대 5개의 프로젝트만 생성할 수 있도록 처리했습니다.


2. 프로젝트 목록 조회 기능 추가

내가 참여 중인 프로젝트 목록을 조회할 수 있도록 구현했습니다.

GET /api/v1/projects

지원하는 조회 조건은 다음과 같습니다.

  • status - 프로젝트 상태 필터
  • cursor - cursor pagination 기준 ID
  • size - 조회 개수

응답은 목록 API 컨벤션에 맞춰 result.items 구조로 구성했습니다.

{
  "isSuccess": true,
  "code": "COMMON200",
  "message": "요청에 성공했습니다.",
  "result": {
    "items": [],
    "nextCursor": null,
    "hasNext": false
  }
}

3. 프로젝트 상세 조회 기능 추가

프로젝트 상세 화면에서 필요한 기본 정보를 조회할 수 있도록 구성했습니다.

GET /api/v1/projects/{projectId}

상세 응답에는 다음 정보가 포함됩니다.

  • 프로젝트 기본 정보
  • 프로젝트 생성자 정보
  • 현재 사용자의 프로젝트 권한
  • 현재 사용자의 프로젝트 내 역할
  • 멤버 수
  • 수정/삭제 가능 여부

4. 프로젝트 수정 및 삭제 기능 추가

프로젝트 수정과 삭제 기능을 추가했습니다.

PATCH /api/v1/projects/{projectId}
DELETE /api/v1/projects/{projectId}

수정/삭제는 ADMIN 권한을 가진 프로젝트 멤버만 가능하도록 검증했습니다.

삭제는 실제 DB row를 제거하지 않고 deletedAt을 기록하는 soft delete 방식으로 처리했습니다.


5. 프로젝트 도메인 예외 코드 추가

프로젝트 도메인에서 사용할 에러 코드를 추가했습니다.

  • PROJECT404 - 프로젝트를 찾을 수 없음
  • PROJECT_MEMBER404 - 프로젝트 멤버를 찾을 수 없음
  • PROJECT403 - 프로젝트 접근 권한 없음
  • PROJECT_ADMIN403 - 프로젝트 관리자 권한 필요
  • PROJECT409 - 무료 계정 프로젝트 생성 제한 초과

6. 임시 인증 헤더 적용

아직 JWT 인증 구조가 연결되지 않았기 때문에, 현재는 임시로 X-USER-ID 헤더에서 사용자 ID를 받아 처리하도록 구성했습니다.

X-USER-ID: 1

추후 인증 모듈이 연결되면 @AuthenticationPrincipal 또는 공통 인증 유틸 기반으로 교체할 예정입니다.


✅ PR 체크리스트

  • PR 제목은 커밋 컨벤션을 따랐습니다.
  • 관련 이슈가 없는 작업임을 본문에 명시했습니다.
  • ./gradlew compileJava로 컴파일을 확인했습니다.

Summary by CodeRabbit

  • 새 기능
    • 프로젝트 생성, 목록 조회, 상세 조회, 수정 및 삭제 기능을 추가했습니다.
    • 상태·커서·페이지 크기 기반 프로젝트 목록 조회를 지원합니다.
    • 프로젝트 상세 정보, 멤버 수, 역할, 권한, 소유자 정보를 제공합니다.
    • 프로젝트 생성 및 수정 시 입력값 검증을 강화했습니다.
    • 프로젝트별 오류 코드와 접근 권한 검증을 추가했습니다.

@chazy-d chazy-d self-assigned this Jul 13, 2026
@chazy-d chazy-d added the feature 새로운 기능 추가 label Jul 13, 2026
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9eb5b3e4-5c13-4d29-944c-c5de4c9a59b3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

프로젝트 생성·목록·상세·수정·삭제 API가 추가되었습니다. 프로젝트 엔티티와 멤버 권한 모델, 요청·응답 DTO, JPA 저장소, 서비스 검증 및 커서 기반 목록 조회가 구현되었습니다.

Changes

프로젝트 관리 API

Layer / File(s) Summary
프로젝트 도메인 계약과 상태
src/main/java/com/slatto/domain/project/dto/*, src/main/java/com/slatto/domain/project/entity/*, src/main/java/com/slatto/domain/project/exception/ProjectErrorCode.java
프로젝트 생성·수정 요청과 목록·상세·기본 응답 DTO가 정의되고, 프로젝트 상태 변경·소프트 삭제·멤버 권한·역할 생성 및 오류 코드가 추가되었습니다.
프로젝트 응답 변환
src/main/java/com/slatto/domain/project/converter/ProjectConverter.java
프로젝트 생성 요청 변환, 목록·상세 응답 구성, 소유자 요약 및 날짜 기반 마감 진행률 계산이 추가되었습니다.
프로젝트 저장소 조회
src/main/java/com/slatto/domain/project/repository/*, src/main/java/com/slatto/domain/user/repository/UserRepository.java
프로젝트·멤버·역할·사용자 JPA 저장소와 활성 멤버 조회, 소프트 삭제 필터, 상태·커서 기반 프로젝트 조회가 추가되었습니다.
프로젝트 서비스 흐름
src/main/java/com/slatto/domain/project/service/ProjectService.java
프로젝트 CRUD, 생성 쿼터와 접근 권한 검증, 멤버 집계, 프리뷰 이미지 및 최근 활동 시각 조합, 커서 페이지네이션이 구현되었습니다.
프로젝트 REST 엔드포인트
src/main/java/com/slatto/domain/project/controller/ProjectController.java
X-USER-ID 헤더를 사용하는 프로젝트 목록·생성·상세·수정·삭제 엔드포인트와 공통 성공 응답이 추가되었습니다.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant ProjectController
  participant ProjectService
  participant ProjectRepository
  participant ProjectMemberRepository
  Client->>ProjectController: 프로젝트 API 요청 및 X-USER-ID 헤더 전달
  ProjectController->>ProjectService: 프로젝트 작업 호출
  ProjectService->>ProjectRepository: 프로젝트 조회·저장·삭제
  ProjectService->>ProjectMemberRepository: 멤버 권한 및 목록 조회
  ProjectService-->>ProjectController: 프로젝트 응답 반환
  ProjectController-->>Client: ApiResponse 반환
Loading

Suggested reviewers: kohseoyoung

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 프로젝트 생성·조회·수정·삭제 CRUD와 관련 엔티티, DTO, 서비스, 컨트롤러 구성을 잘 요약합니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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

Inline comments:
In `@src/main/java/com/slatto/domain/project/entity/Project.java`:
- Around line 70-137: Update Project’s constructor and updateInfo to validate
that endDate is not earlier than startDate before assigning or persisting it.
For creation, compare against the initialized current start date; for updates,
compare against the project’s existing startDate, and reject invalid dates using
the entity’s established validation approach.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a8e48c0a-9a23-4481-b01a-733b4effc4a5

📥 Commits

Reviewing files that changed from the base of the PR and between b940bae and 28c7dd7.

📒 Files selected for processing (16)
  • src/main/java/com/slatto/domain/project/controller/ProjectController.java
  • src/main/java/com/slatto/domain/project/converter/ProjectConverter.java
  • src/main/java/com/slatto/domain/project/dto/ProjectCreateRequest.java
  • src/main/java/com/slatto/domain/project/dto/ProjectDetailResponse.java
  • src/main/java/com/slatto/domain/project/dto/ProjectListResponse.java
  • src/main/java/com/slatto/domain/project/dto/ProjectResponse.java
  • src/main/java/com/slatto/domain/project/dto/ProjectUpdateRequest.java
  • src/main/java/com/slatto/domain/project/entity/Project.java
  • src/main/java/com/slatto/domain/project/entity/ProjectMember.java
  • src/main/java/com/slatto/domain/project/entity/ProjectUserRole.java
  • src/main/java/com/slatto/domain/project/exception/ProjectErrorCode.java
  • src/main/java/com/slatto/domain/project/repository/ProjectMemberRepository.java
  • src/main/java/com/slatto/domain/project/repository/ProjectRepository.java
  • src/main/java/com/slatto/domain/project/repository/ProjectUserRoleRepository.java
  • src/main/java/com/slatto/domain/project/service/ProjectService.java
  • src/main/java/com/slatto/domain/user/repository/UserRepository.java

Comment on lines +70 to +137

private Project(
Users ownerUser,
String title,
CategoryName type,
String customTypeName,
LengthType lengthType,
String description,
LocalDate endDate,
String clientName,
Kind kind
) {
this.ownerUser = ownerUser;
this.title = title;
this.type = type;
this.customTypeName = customTypeName;
this.lengthType = lengthType;
this.description = description;
this.startDate = LocalDate.now();
this.endDate = endDate;
this.clientName = clientName;
this.status = DEFAULT_STATUS;
this.kind = kind;
}

public static Project create(
Users ownerUser,
String title,
CategoryName type,
String customTypeName,
LengthType lengthType,
String description,
LocalDate endDate,
String clientName,
Kind kind
) {
return new Project(
ownerUser,
title,
type,
customTypeName,
lengthType,
description,
endDate,
clientName,
kind
);
}

public void updateInfo(
String title,
CategoryName type,
String customTypeName,
LengthType lengthType,
String description,
LocalDate endDate,
String clientName,
Kind kind
) {
this.title = title;
this.type = type;
this.customTypeName = customTypeName;
this.lengthType = lengthType;
this.description = description;
this.endDate = endDate;
this.clientName = clientName;
this.kind = kind;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

endDate가 시작일 이전이어도 생성/수정이 허용됩니다.

create/updateInfo 어디에서도 endDatestartDate(생성 시점의 오늘 날짜) 이후인지 검증하지 않습니다. 잘못된 기간의 프로젝트가 그대로 저장될 수 있으며, ProjectConverter#calculateDeadlineProgressPercent가 이 경우 무조건 100%를 반환하는 것도 이 누락의 증상입니다(관련 코멘트는 통합 코멘트 섹션 참고).

제안: 생성자/updateInfo에 유효성 검증 추가
     private Project(
         Users ownerUser,
         String title,
         CategoryName type,
         String customTypeName,
         LengthType lengthType,
         String description,
         LocalDate endDate,
         String clientName,
         Kind kind
     ) {
+        LocalDate startDate = LocalDate.now();
+        if (!endDate.isAfter(startDate)) {
+            throw new ProjectException(ProjectErrorCode.INVALID_PROJECT_PERIOD);
+        }
         this.ownerUser = ownerUser;
         this.title = title;
         this.type = type;
         this.customTypeName = customTypeName;
         this.lengthType = lengthType;
         this.description = description;
-        this.startDate = LocalDate.now();
+        this.startDate = startDate;
         this.endDate = endDate;
         this.clientName = clientName;
         this.status = DEFAULT_STATUS;
         this.kind = kind;
     }
🤖 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/slatto/domain/project/entity/Project.java` around lines 70
- 137, Update Project’s constructor and updateInfo to validate that endDate is
not earlier than startDate before assigning or persisting it. For creation,
compare against the initialized current start date; for updates, compare against
the project’s existing startDate, and reject invalid dates using the entity’s
established validation approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature 새로운 기능 추가

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants