Skip to content

게시글 삭제 시 FK 제약으로 인한 오류 수정#74

Merged
hej090224 merged 1 commit intodevelopfrom
refactor/report
Dec 30, 2025
Merged

게시글 삭제 시 FK 제약으로 인한 오류 수정#74
hej090224 merged 1 commit intodevelopfrom
refactor/report

Conversation

@hej090224
Copy link
Collaborator

💡 배경 및 개요

FK 오류 해결
Resolves: #{이슈번호}

📃 작업내용

어드민 게시글 삭제 API에서 다른 테이블을 참조하여 생기는 FK 제약 위반 오류를 해결하였습니다

🙋‍♂️ 리뷰노트

구현 시에 고민이었던 점들 혹은 특정 부분에 대한 의도가 있었다면 PR 리뷰의 이해를 돕기 위해 서술해주세요!

또한 리뷰어에게 특정 부분에 대한 집중 혹은 코멘트 혹은 질문을 요청하는 경우에 작성하면 좋아요!

e.g. 작업을 끝내야할 시간이 얼마 없어 확장성보다는 동작을 위주로 만들었어요! 감안하고 리뷰해주세요!

✅ PR 체크리스트

템플릿 체크리스트 말고도 추가적으로 필요한 체크리스트는 추가해주세요!

  • 이 작업으로 인해 변경이 필요한 문서가 변경되었나요? (e.g. .env, 노션, README)
  • 이 작업을 하고나서 공유해야할 팀원들에게 공유되었나요? (e.g. "API 개발 완료됐어요", "환경값 추가되었어요")
  • 작업한 코드가 정상적으로 동작하나요?
  • Merge 대상 브랜치가 올바른가요?
  • PR과 관련 없는 작업이 있지는 않나요?

🎸 기타

@hej090224 hej090224 requested a review from cfcromn December 30, 2025 03:24
@hej090224 hej090224 self-assigned this Dec 30, 2025
@hej090224 hej090224 added the Fix label Dec 30, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @hej090224, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 관리자 게시글 삭제 API에서 발생하는 외래 키 제약 조건 위반 오류를 해결합니다. 기존에는 게시글 삭제 시 연관된 다른 테이블의 데이터가 남아있어 오류가 발생했지만, 이제는 게시글 삭제 전에 해당 게시글에 연결된 모든 댓글, 이미지, 좋아요, 신고 데이터를 명시적으로 삭제함으로써 데이터 무결성을 유지하고 게시글이 성공적으로 삭제되도록 보장합니다.

Highlights

  • 외래 키 제약 조건 오류 해결: 게시글 삭제 시 발생하는 외래 키 제약 조건 위반 오류를 해결했습니다.
  • 연관 데이터 선제적 삭제: 게시글을 삭제하기 전에 해당 게시글과 연관된 댓글, 이미지, 좋아요, 신고 데이터를 먼저 삭제하도록 로직을 추가했습니다.
  • 새로운 삭제 메서드 추가: CommentRepository, PostImageRepository, PostLikeRepository, ReportRepository에 postId를 기준으로 연관 데이터를 일괄 삭제하는 @Modifying 쿼리 메서드를 추가했습니다.
  • PostRepository의 좋아요 삭제: PostRepository에도 'like' 테이블에서 특정 postId에 해당하는 데이터를 삭제하는 네이티브 쿼리 메서드를 추가했습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

게시글 삭제 시 FK 제약 오류를 해결하기 위해 관련 엔티티들을 먼저 삭제하도록 수정한 점이 좋습니다. 다만, 몇 가지 중복되거나 불필요한 코드가 있고, 잘못된 네이티브 쿼리가 포함되어 있어 개선이 필요해 보입니다. 아래에 자세한 리뷰를 남겼으니 확인 부탁드립니다.

Copy link
Collaborator

@cfcromn cfcromn left a comment

Choose a reason for hiding this comment

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

수고하셨어용

@hej090224 hej090224 merged commit c12af27 into develop Dec 30, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants