Skip to content

[3주차] 이은표/[feat] 게시글 도메인 API구현#116

Open
vyfhfhd wants to merge 4 commits intoLeets-Official:이은표/mainfrom
vyfhfhd:이은표/3주차

Hidden character warning

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

[3주차] 이은표/[feat] 게시글 도메인 API구현#116
vyfhfhd wants to merge 4 commits intoLeets-Official:이은표/mainfrom
vyfhfhd:이은표/3주차

Conversation

@vyfhfhd
Copy link
Copy Markdown

@vyfhfhd vyfhfhd commented Apr 7, 2026

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

  • 게시글 목록 조회, 상세조회(get)
  • 게시글 작성(post)
  • 게시글 수정(patch)
  • 게시글 삭제(delete)
  • 성공, 실패(예외처리) 응답

2. 핵심 변경 사항

  1. PostUpdateRequest DTO를 생성하여 게시글 수정 요청 데이터를 처리
  2. ForbiddenPostAccessException을 생성하여 작성자가 아닌 사용자의 수정/삭제 시 예외가 발생하도록 구현.
  3. GlobalExceptionHandler에 ForbiddenPostAccessException 처리 로직을 추가하여 권한이 없는 요청에 대해 403 응답 반환.

3. 실행 및 검증 결과

  • 실행 결과:
  1. 게시글 목록 확인
image
  1. 특정 게시글 상세 조회 - 성공
image

특정 게시글 상세 조회 - 실패
image

  1. 새로운 게시글 작성 - 성공
image
  1. 자신이 작성한 게시글 수정 - 성공
image

자신이 작성한 게시글 수정 - 실패
image

  1. 자신이 작성한 게시글 삭제 - 성공
image

자신이 작성한 게시글 삭제 - 실패
image

4. 완료 사항

  1. 게시글 생성, 수정, 삭제, 조회
  2. 요청 성공, 실패했을 경우 안내메세지 지

5. 추가 사항

  • 관련 이슈: closed #이슈번호

#119

제출 체크리스트

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

Reviewer 참고

@vyfhfhd vyfhfhd requested a review from a team April 7, 2026 14:33
@vyfhfhd vyfhfhd self-assigned this Apr 7, 2026
Copy link
Copy Markdown

@kangyeson kangyeson left a comment

Choose a reason for hiding this comment

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

고생하셨습니다~


private final UserRepository userRepository;

@PostMapping
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

테스트용으로 CreateUser API도 같이 구현하신거 좋습니다!

public class ForbiddenPostAccessException extends RuntimeException {

public ForbiddenPostAccessException() {
super("본인이 작성한 게시글만 수정 또는 삭제할 수 있습니다.");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

에러마다 예외처리를 하기 보다, Post도메인의 공통 예외처리부분을 만들어두고 에러코드를 ENUM으로 관리하면 더 효율적이고 깔끔하게 관리할 수 있을 것 같습니다!

Copy link
Copy Markdown

@KunHeeLee7 KunHeeLee7 left a comment

Choose a reason for hiding this comment

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

과제 하느라 고생하셨어요~!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍에러 상황들을 ErrorCode Enum으로 모아서 관리하신 점이 인상 깊어요! 덕분에 유지보수도 편하고, 클라이언트에게 전달되는 정보도 더 풍부해지는 것 같습니다.

Comment on lines +15 to +16
public static <T> ApiResponse<T> success(T result) {
return new ApiResponse<>(true, "SUCCESS", "요청에 성공했습니다.", result);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ 우리가 맞춘 명세서 규칙대로 성공 코드도 POST200_1 같은 형식으로 수정해주시면 프론트에서 처리하기 더 좋을 것 같아요!

}

public static ApiResponse<?> fail(String code, String message) {
return new ApiResponse<>(false, code, message, null);
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 가 null로 반환 되니까 정적 팩토리 메서드를 ApiResponse 타입을 리턴하도록 하면 좋을 것 같습니다.

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