-
Notifications
You must be signed in to change notification settings - Fork 1
♻️ Refactor: Modify project CRUD logic to apply a common response format #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
…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.
3 tasks
leeeunda
reviewed
Aug 11, 2025
Contributor
leeeunda
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
확인했습니다! 수고하셨습니다.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
✏️PR 타입(하나 이상의 PR 타입을 선택해 주세요)
🌴반영 브랜치
feature/project-api->develop📌변경 사항
기존 프로젝트 CRUD API의 Response Body를 공통 응답 DTO(
ResponseDto)로 변경ProjectController의 모든 API 반환 타입을ResponseDto<T>로 통일했습니다.ProjectService가 순수한 데이터 DTO만 반환하도록 수정하고, Controller에서ResponseDto로 감싸도록 역할을 분리했습니다.성공 및 실패 시의 상태 코드와 메시지 표준화
IllegalArgumentException,AccessDeniedException등을CommonException과ErrorCode를 사용하는 방식으로 통일했습니다.NOT_FOUND_PROJECT에러 코드를 사용하도록 수정했습니다.ACCESS_DENIED에러가 반환되도록 접근 권한 검증 로직을 추가했습니다.변경된 응답 구조에 맞게 Swagger 업데이트
💯테스트 결과
201 Created및 생성된 프로젝트 정보 반환 확인200 OK및 프로젝트 목록 반환 확인200 OK및 수정된 프로젝트 정보 반환 확인204 No Content반환 확인404 Not Found및NOT_FOUND_PROJECT에러 반환 확인403 Forbidden및ACCESS_DENIED에러 반환 확인401 Unauthorized및AUTHENTICATION_REQUIRED에러 반환 확인