Skip to content

[3주차] 변승현/[feat] 게시글 도메인 API 구현#92

Open
gusanans218 wants to merge 7 commits intoLeets-Official:변승현/mainfrom
gusanans218:변승현/3주차

Hidden character warning

The head ref may contain hidden characters: "\ubcc0\uc2b9\ud604/3\uc8fc\ucc28"
Open

[3주차] 변승현/[feat] 게시글 도메인 API 구현#92
gusanans218 wants to merge 7 commits intoLeets-Official:변승현/mainfrom
gusanans218:변승현/3주차

Conversation

@gusanans218
Copy link
Copy Markdown

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

  • 게시글 CRUD API 구현
    • 게시글 생성 (POST /api/posts)
    • 게시글 목록 조회 (GET /api/posts)
    • 게시글 상세 조회 (GET /api/posts/{postId})
    • 게시글 수정 (PATCH /api/posts/{postId})
    • 게시글 삭제 (DELETE /api/posts/{postId})
  • 요청/응답 DTO 분리
  • 입력값 validation 적용 (@Valid, @notblank, @NotNull)
  • 전역 예외 처리 (GlobalExceptionHandler) 구현
  • 공통 응답 구조 (ApiResponse) 적용

2. 핵심 변경 사항

  • Post, User 엔티티 및 PostRepository, UserRepository 추가
  • 게시글 관련 DTO (Create/Update/Delete/Response) 정의
  • PostController에서 REST API 엔드포인트 구현
  • GlobalExceptionHandler를 통해 validation 및 예외 응답 처리
  • ApiResponse를 활용하여 응답 형식 통일

3. 실행 및 검증 결과

GET /api/posts/ 정상 실행 결과
스크린샷 2026-04-06 21 09 07
GET /api/posts/ 정상 실행 결과 (size 1로 두었을때
스크린샷 2026-04-06 21 11 25
POST /api/posts/ 정상 실행 결과
스크린샷 2026-04-06 21 08 05
POST /api/posts/ validation 관련 실행 결과 (title 널로 했을때)
스크린샷 2026-04-06 21 10 39
GET /api/posts/{postId} 정상 실행 결과
스크린샷 2026-04-06 21 09 45
PATCH /api/posts/{postId} 정상 실행 결과
스크린샷 2026-04-06 21 10 04
DELTE /api/posts/{postId} 정상 실행 결과
스크린샷 2026-04-06 21 10 17
DELETE /api/posts/ validation 관련 실행 결과 (등록되지 않은 POST 삭제 요청 했을 때)
스크린샷 2026-04-06 21 11 46

4. 완료 사항

  1. 게시글 CRUD API 전체 구현
  2. DTO 기반 요청/응답 구조 설계
  3. validation 적용 및 입력값 검증 구현
  4. 전역 예외 처리 및 공통 응답 구조 적용

5. 추가 사항

제출 체크리스트

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

@gusanans218 gusanans218 self-assigned this Apr 6, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 244395bfa0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@gusanans218 gusanans218 requested a review from a team April 6, 2026 13:01
Copy link
Copy Markdown

@Hanharam Hanharam left a comment

Choose a reason for hiding this comment

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

👍 DTO, Service에서 검증하신 점이 좋았습니다. 전체적인 흐름도 좋습니다! PostQueryService와 PostCommandService로 분리, 에러 코드를 enum으로 관리하는 것도 고려해보시면 좋을 것 같습니다!

Copy link
Copy Markdown

@N-yujeong N-yujeong left a comment

Choose a reason for hiding this comment

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

👍 전체적으로 과제 요구사항을 잘 반영하여 구현하신 것 같습니다.
특히 GlobalExceptionHandler를 통해 예외 처리를 공통화한 부분이 인상적이었습니다.

Copy link
Copy Markdown

@jihoonkim501 jihoonkim501 left a comment

Choose a reason for hiding this comment

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

승현님 수고많으셨습니다~! 커스텀 예외처리가 눈에 띄게 잘 짜신 것 같습니다! 제 코멘트 한번만 확인 부탁 드립니다~!

Comment on lines +24 to +25
@RequestParam(defaultValue = "0") @Min(value = 0, message = "페이지 번호는 0 이상이어야 합니다.") int page,
@RequestParam(defaultValue = "10") @Min(value = 1, message = "페이지 크기는 1 이상이어야 합니다.") int size
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이미 알고 계시겠지만 이 부분은 DTO에서 검증할 수 있습니다~! 컨트롤러단에서는 요청을 받고 보내는 역할로 두는것을 추천드립니다~!

Comment on lines +5 to +8
public record PostDeleteRequest(
@NotNull(message = "userId는 필수입니다.")
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.

게시글 삭제하는데 유저아이디로만 삭제하고 있습니다! PostId를 추가로 받아서 선택삭제하는 방법을 의도하신거라면 postId가 필요해보입니다!

Long postId,
String title,
String content,
String imageUrl,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

확장성을 고려하여 List 을 이용하여 2개 이상 이미지를 응답으로 보내는것도 고려해보시면 좋을 것 같습니다!

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