Skip to content
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

[#34] 카드 게시글 CRUD 기능 추가 #41

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

abcdana
Copy link
Collaborator

@abcdana abcdana commented Mar 6, 2025

  • 게시글 등록 API 추가 (POST /api/community/posts)
  • 게시글 수정 API 추가 (PUT /api/community/posts/{postId})
  • 게시글 삭제 API 추가 (DELETE /api/community/posts/{postId})
  • 특정 게시글 상세 조회 API 추가 (GET /api/community/posts/{postId})
    • 게시글의 상세 정보(제목, 내용, 작성자, 작성일) 제공
    • 댓글 수, 좋아요 수, 북마크 수 포함하여 반환
  • 전체 게시글 페이징 조회 API 추가 (GET /api/community/posts)
    • 최신순(기본값), 좋아요순, 댓글순 정렬 가능 (sortBy 파라미터 추가)
    • Page 형태로 반환
  • PostService, PostRepository 수정
    • PostRepository에서 댓글 수, 좋아요 수, 북마크 수를 조회하는 메서드 추가
    • PostService에서 정렬 조건 적용하여 게시글 목록 조회
  • Swagger 적용

@abcdana abcdana requested a review from f-lab-paul March 6, 2025 07:26
@abcdana abcdana self-assigned this Mar 6, 2025
Copy link

@f-lab-paul f-lab-paul left a comment

Choose a reason for hiding this comment

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

일단 머지하고 자세한 내용은 메토링떄 얘기해봐요. 몇가지 빠진 것들이 있어요.

// 게시글 수정
@Transactional
public void updatePost(Long id, PostRequestDto requestDto) {
Post post = postRepository.findById(id)

Choose a reason for hiding this comment

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

권한 체크가 다 빠져있어요. 예를 들면 여기서 유저 정보를 파라미터로 받아서 해당 유저가 이 포스트의 주인이 맞는지 확인하는 부분들이 추가 되어야해요.

// 게시글 삭제
@Transactional
public void deletePost(Long id) {
if (!postRepository.existsById(id)) {

Choose a reason for hiding this comment

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

여기도 마찬가지로 권한체크 필요해요. 권한 관련은 멘토링때 같이보죠

@AllArgsConstructor
@Builder
@EntityListeners(AuditingEntityListener.class)
public class Image {

Choose a reason for hiding this comment

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

여기에 created_at, updated_at같은 auditing요 컬럼들을 부모클래스로 구현하는 부분 필요해요. 멘토링떄 얘기해보죠

@PostMapping
@Operation(summary = "게시글 등록 API", description = "새로운 게시글을 등록합니다.")
public CommonResponse<Long> createPost(@RequestBody PostRequestDto requestDto) {
return CommonResponse.success(postService.createPost(requestDto));

Choose a reason for hiding this comment

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

여기에 validation check 필요

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.

카드 게시글 CRUD API
2 participants