-
Notifications
You must be signed in to change notification settings - Fork 2
MOSU-246 refactor: 공지, 질문 로직 수정 #247
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
Changes from all commits
be9b81c
b3421cd
0f3198d
0700fce
46a6bac
dafcc96
1983734
bde3392
722d9c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,15 +25,18 @@ public class InquiryAnswerJpaEntity extends BaseTimeEntity { | |
| @Column(name = "inquiry_answer_id", nullable = false) | ||
| private Long id; | ||
|
|
||
| @Column(name = "title", nullable = false, length = 3000) | ||
| @Column(name = "title", nullable = false, length = 300) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainVerify the title length reduction impact. The title column length was reduced from 3000 to 300 characters. This is a significant reduction that could cause data truncation if existing records exceed the new limit. 🏁 Script executed: #!/bin/bash
# Description: Check for existing inquiry answer titles that exceed 300 characters
# Expected: Should return any titles longer than 300 characters that would be truncated
# Search for the table structure and any existing data concerns
rg -A 5 -B 5 "inquiry_answer" --type sql
# Look for any migration files that handle this change
fd -e sql -e java | xargs rg -l "ALTER.*inquiry_answer.*title|title.*300"Length of output: 435 Add a DB migration for title length reduction We didn’t detect any SQL migration altering the Suggested fixes:
🤖 Prompt for AI Agents |
||
| private String title; | ||
|
|
||
| @Column(name = "content", nullable = false) | ||
| @Column(name = "content", nullable = false, length = 1000) | ||
| private String content; | ||
|
|
||
| @Column(name = "inquiry_id", nullable = false) | ||
| private Long inquiryId; | ||
|
|
||
| @Column(name = "author", nullable = false) | ||
| private String author; | ||
|
|
||
| @Column(name = "user_id", nullable = false) | ||
| private Long userId; | ||
|
|
||
|
|
@@ -42,16 +45,20 @@ public InquiryAnswerJpaEntity( | |
| final String title, | ||
| final String content, | ||
| final Long inquiryId, | ||
| final Long userId | ||
| final Long userId, | ||
| final String author | ||
|
|
||
| ) { | ||
| this.title = title; | ||
| this.content = content; | ||
| this.inquiryId = inquiryId; | ||
| this.userId = userId; | ||
| this.author = author; | ||
| } | ||
|
|
||
| public void update(final String title, final String content) { | ||
| public void update(final String title, final String content, final String author) { | ||
| this.title = title; | ||
| this.content = content; | ||
| this.author = author; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Verify that deleteInquiryAnswer handles missing answers gracefully.
The unconditional call to
deleteInquiryAnswersimplifies the deletion logic, but ensure that this method can handle cases where no inquiry answer exists without throwing exceptions.🏁 Script executed:
Length of output: 57
🏁 Script executed:
Length of output: 950
Further inspecting
deleteInquiryAnswerimplementation to confirm it handles missing entries without exceptions.🏁 Script executed:
Length of output: 1161
Ensure
deleteInquiryAnswerhandles missing answers without throwingThe current implementation in
InquiryAnswerService.java(lines 54–56) will throw aCustomRuntimeExceptionwhen no answer exists, causingdeleteInquiryto fail for inquiries that simply have no answers. To make deletion idempotent, update the method to only delete if an answer is found:• File:
src/main/java/life/mosu/mosuserver/application/inquiry/InquiryAnswerService.java• Method:
public void deleteInquiryAnswer(Long postId)Suggested change:
This ensures that deleting an inquiry without an existing answer will not throw an exception but simply no-op the answer cleanup.
🤖 Prompt for AI Agents