Skip to content

[3주차] 이예서/[feat] 게시글 API 구현#114

Open
HandoA01 wants to merge 15 commits intoLeets-Official:이예서/mainfrom
HandoA01:이예서/3주차

Hidden character warning

The head ref may contain hidden characters: "\uc774\uc608\uc11c/3\uc8fc\ucc28"
Open

[3주차] 이예서/[feat] 게시글 API 구현#114
HandoA01 wants to merge 15 commits intoLeets-Official:이예서/mainfrom
HandoA01:이예서/3주차

Conversation

@HandoA01
Copy link
Copy Markdown

@HandoA01 HandoA01 commented Apr 7, 2026

1. 과제 요구사항 중 구현한 내용

  • 게시글 목록 조회 GET /posts
  • 게시글 상세 조회 GET /posts/{postId}
  • 게시글 작성 POST /posts
  • 게시글 수정 PATCH /posts/{postId}
  • 게시글 삭제 DELETE /posts/{postId}

2. 핵심 변경 사항

  • ApiResponse 공통 응답 포맷 적용 (isSuccess, code, message, result)
  • ErrorCode enum으로 에러 코드 일원화 관리
  • GlobalExceptionHandler에 게시글 관련 예외 처리 추가
  • PostConverter를 통한 Entity ↔ DTO 변환 책임 분리
  • BaseEntitydelete() 메서드를 활용한 soft delete 구현
  • Request DTO에 @NotBlank, @NotNull, @Size 등 Bean Validation 적용
  • Controller에서 @Valid로 요청 데이터 검증 활성화

3. 실행 및 검증 결과

  • 프로젝트 정상 실행 확인
스크린샷 2026-04-07 오후 9 48 57

4. 완료 사항

  • 게시글 목록 조회 API 구현
  • 게시글 상세 조회 API 구현
  • 게시글 작성 API 구현
  • 게시글 수정 API 구현
  • 게시글 삭제 API (soft delete) 구현
  • 공통 응답 포맷 ApiResponse 적용
  • 전역 예외 처리 GlobalExceptionHandler 적용
  • Entity와 DTO 분리 및 PostConverter 적용
  • Bean Validation + @Valid 적용
  • 404, 403, 400, 500 예외 처리 구현

5. 추가 사항

제출 체크리스트

  • PR 제목이 규칙에 맞다
  • base가 {이름}/main 브랜치다
  • compare가 {이름}/{숫자}주차 브랜치다
  • 프로젝트가 정상 실행된다
  • 본인을 Assignee로 지정했다
  • 파트 담당 Reviewer를 지정했다
  • 리뷰 피드백을 반영한 뒤 머지/PR close를 진행한다

Reviewer 참고

@HandoA01 HandoA01 requested a review from a team April 7, 2026 13:52
@HandoA01 HandoA01 self-assigned this Apr 7, 2026
@HandoA01 HandoA01 changed the title [3주차] 이예서/feat 게시글 API 구현 [3주차] 이예서/[feat] 게시글 API 구현 Apr 7, 2026
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;

@RestControllerAdvice
public class GlobalExceptionHandler {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

전반적으로 코드가 깔끔해서 읽기 되게 좋은 것 같습니다!
예외처리도 글로벌에서 세분화해서 처리한 것도 좋아보이네요.

public class PostCreateRequest {

@NotNull(message = "사용자 ID는 필수입니다.")
private Long userId;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

현재는 Request DTO 안에 userId가 포함되어 있는데, 나중에 Spring Security 등을 도입하게 된다면 컨트롤러에서 인증된 유저 정보를 서비스에 인자로 넘겨주는 방식이 더 안전할 수 있어 이러한 방향도 고민해 보면 좋을 것 같습니다!

@HyeonSeongIM HyeonSeongIM self-requested a review April 9, 2026 09:37
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Service를 Intetface로 구성하고 ServiceImpl로 구현 클래스를 따로 두는 방식도 좋은 유지보수 코드가 될 것 같아요!

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants