Skip to content

[DP-307/308] 커뮤니티 게시글/답변 삭제, 중복 제출, 목록 필드 누락, 타임스탬프 불일치 수정#122

Merged
nYeonG4001 merged 2 commits intodevelopV2from
auto/fix/community-bugs
Apr 12, 2026
Merged

[DP-307/308] 커뮤니티 게시글/답변 삭제, 중복 제출, 목록 필드 누락, 타임스탬프 불일치 수정#122
nYeonG4001 merged 2 commits intodevelopV2from
auto/fix/community-bugs

Conversation

@nYeonG4001
Copy link
Copy Markdown
Collaborator

수정 내용

1. 게시글/답변 삭제 안 됨

  • 원인: FK 제약조건 위반 — 자식 레코드를 삭제하지 않고 부모 삭제 시도
  • 수정: deletePost / deleteAnswer 에서 자식 레코드(comments, answer_likes, post_likes, ai_answers, ai_questions, history) 순서대로 먼저 삭제 후 부모 삭제

2. 동일한 글 2개 생성 (중복 제출)

  • 원인: 더블클릭 등 중복 제출 방어 로직 없음
  • 수정: 같은 유저가 10초 이내 동일 제목으로 제출 시 409 반환

3. GET /posts 필드 누락 (answerCount, contentPreview, topAnswerPreview)

  • 원인: PostSummaryResponse에 해당 필드 미구현
  • 수정: 배치 쿼리로 answer 수 및 첫 번째 답변 미리보기 조회 후 응답에 포함

4. 답변 createdAt ≠ updatedAt (처음 작성인데 수정됨으로 표시)

  • 원인: BaseTimeEntity.@PrePersist에서 LocalDateTime.now() 두 번 호출 → 나노초 차이
  • 수정: 단일 변수로 통일

변경 파일

  • BaseTimeEntity — PrePersist 타임스탬프 단일화
  • CommentRepository, AnswerLikeRepository, PostLikeRepository, AiAnswerRepository, AiQuestionRepository, AnswerRepository, HistoryRepository — 삭제 쿼리 추가
  • PostRepository — 중복 제출 체크 메서드 추가
  • ErrorCode — COMMUNITY_013 추가
  • PostSummaryResponse — answerCount, contentPreview, topAnswerPreview 필드 추가
  • PostService, AnswerService — 삭제 로직 및 중복 방지 로직 적용
  • 관련 테스트 수정

@nYeonG4001 nYeonG4001 changed the title [fix] 커뮤니티 게시글/답변 삭제, 중복 제출, 목록 필드 누락, 타임스탬프 불일치 수정 [DP-307/308] 커뮤니티 게시글/답변 삭제, 중복 제출, 목록 필드 누락, 타임스탬프 불일치 수정 Apr 12, 2026
@sonarqubecloud
Copy link
Copy Markdown

@nYeonG4001 nYeonG4001 merged commit b5abb53 into developV2 Apr 12, 2026
3 checks passed
@nYeonG4001 nYeonG4001 deleted the auto/fix/community-bugs branch April 12, 2026 10:20
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.

1 participant