Skip to content

Conversation

@parksomii
Copy link
Contributor

✏️PR 타입(하나 이상의 PR 타입을 선택해 주세요)

  • 기능 추가
  • 기능 삭제
  • 버그 수정
  • 문서 수정
  • 코드 리팩토링
  • 주석 추가 및 수정
  • 파일 혹은 폴더명 수정
  • 테스트 추가, 테스트 리팩토링
  • 의존성, 환경 변수, 빌드 관련 코드 업데이트

🌴반영 브랜치

feature/project-api -> develop

📌변경 사항

  • 기존 프로젝트 CRUD API의 Response Body를 공통 응답 DTO(ResponseDto)로 변경

    • ProjectController의 모든 API 반환 타입을 ResponseDto<T>로 통일했습니다.
    • ProjectService가 순수한 데이터 DTO만 반환하도록 수정하고, Controller에서 ResponseDto로 감싸도록 역할을 분리했습니다.
  • 성공 및 실패 시의 상태 코드와 메시지 표준화

    • IllegalArgumentException, AccessDeniedException 등을 CommonExceptionErrorCode를 사용하는 방식으로 통일했습니다.
    • 프로젝트를 찾지 못했을 때 NOT_FOUND_PROJECT 에러 코드를 사용하도록 수정했습니다.
    • 프로젝트 멤버가 아닌 사용자의 수정/삭제 시도를 차단하고 ACCESS_DENIED 에러가 반환되도록 접근 권한 검증 로직을 추가했습니다.
  • 변경된 응답 구조에 맞게 Swagger 업데이트

💯테스트 결과

  • Swagger UI를 통해 모든 API의 성공/실패 케이스 테스트를 완료했습니다.
    • 성공:
      • 프로젝트 생성(POST): 201 Created 및 생성된 프로젝트 정보 반환 확인
      • 프로젝트 목록 조회(GET): 200 OK 및 프로젝트 목록 반환 확인
      • 프로젝트 수정(PUT): 200 OK 및 수정된 프로젝트 정보 반환 확인
      • 프로젝트 삭제(DELETE): 204 No Content 반환 확인
    • 실패:
      • 존재하지 않는 프로젝트에 대한 요청: 404 Not FoundNOT_FOUND_PROJECT 에러 반환 확인
      • 권한 없는 사용자의 수정/삭제 요청: 403 ForbiddenACCESS_DENIED 에러 반환 확인
      • 유효하지 않은 토큰으로 요청: 401 UnauthorizedAUTHENTICATION_REQUIRED 에러 반환 확인

parksomii added 22 commits July 23, 2025 01:36
Introduced blockInfo and connectionInfo fields to store architecture data as JSON in the Project entity. Added updateArchitecture method for updating block information and improved documentation for update methods.
Introduces BlockSaveRequestDto with createdAt, updatedAt, and blocks fields to support block save operations. Includes Lombok annotations for boilerplate code reduction.
Introduces BlockSaveResponseDto with success, message, and data fields, including a nested BlockInfo class to encapsulate projectId, architectureName, and updatedAt. This DTO will be used to standardize responses for block save operations.
Introduces BlockService with methods to save and retrieve block architecture data for projects. Integrates with ProjectRepository and handles JSON serialization of block information.
Introduces BlockController with endpoints to save and retrieve block architecture data for specific projects. Includes Swagger documentation for API operations and response examples.
Added custom authenticationEntryPoint to respond with a JSON message when authentication fails, improving client-side error handling for unauthorized requests.
Introduces GlobalExceptionHandler to handle common API errors: invalid JSON (400), access denied (403), and project not found (404), returning structured error responses.
…d-backend into feature/block-api

# Conflicts:
#	src/main/java/com/blockcloud/domain/project/Project.java
Flattened BlockSaveResponseDto by removing the nested BlockInfo class and moving its fields to the top level. Removed unused fields 'success', 'message', and 'data' for a simpler response structure.
Refactored BlockService to add project member validation for block save and get operations, ensuring only authorized users can access or modify project architecture. Replaced generic response maps with dedicated DTOs for block retrieval, improved exception handling, and updated method signatures to include user email for authorization.
Updated BlockController endpoints to return ResponseDto wrappers instead of ResponseEntity, and to require Authentication for both saving and retrieving blocks.
Updated the SecurityConfig to return 401 Unauthorized errors using a standardized response DTO and error code (AUTHENTICATION_REQUIRED).
Introduces a new 'blockInfo' field to store additional project information as LONGTEXT and provides an 'updateArchitecture' method to update this field.
Changed the type of the 'projects' field from List<ProjectResponseDto.ProjectInfo> to List<ProjectResponseDto> for consistency.
Removed the nested ProjectInfo class and moved its fields directly into ProjectResponseDto. Also removed the 'success' field. This simplifies the DTO structure for project responses.
Replaced generic and security exceptions with custom CommonException and ErrorCode for better error handling. Extracted project member validation and project lookup into private methods. Simplified ProjectResponseDto creation with a dedicated mapping method and updated methods to use it. Updated list and update methods to use new DTO mapping and error handling.
…oller

Replaces ResponseEntity and CommonResponse with a generic ResponseDto for all endpoints in ProjectController. Updates API response documentation, simplifies constructor with Lombok's @requiredargsconstructor, and standardizes response codes and messages for consistency.
Copy link
Contributor

@leeeunda leeeunda left a comment

Choose a reason for hiding this comment

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

확인했습니다! 수고하셨습니다.

@parksomii parksomii merged commit c29680b into develop Aug 11, 2025
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

♻️ Refactor - 공통 응답 포맷 적용을 위한 프로젝트 CRUD 로직 수정

3 participants