Repository navigation
fix(schema): add unique guild+thread constraint to guildforumthread - #1603
LucasSantana-Dev wants to merge 1 commit into
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe reaction-role delete flow now catches service failures in both the backend API route and the bot handler. New tests cover service rejection cases for each path. ChangesReaction-role delete error handling
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Suggested labels
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Failed to generate code suggestions for PR |
The DELETE reaction-roles endpoint was treating database errors the same as "record not found" cases, returning 404 instead of 500. The service method already throws non-P2025 errors correctly; the route handler now catches and properly escalates these errors. Updated bot handler to wrap the call in try-catch to gracefully handle DB errors and provide appropriate user feedback instead of crashing. Fixes: #1536
a179ed1 to
8bb8542
Compare
|
Closing - this was an incorrect merge. Will create a new PR for the correct changes. |
|




Summary
Adds a unique index on
(guildId, threadId)to prevent duplicate rows for the same thread in theGuildForumThreadmodel.The existing
@@unique([guildId, slug])constraint only enforced slug uniqueness within a guild, not thread uniqueness. This left the schema vulnerable to duplicate entries for the same thread.Closes #1534
Summary by cubic
Add a unique
(guildId, threadId)constraint toGuildForumThreadto prevent duplicate threads, and fix reaction-role deletion to return proper errors and show a clear bot message on failures.Bug Fixes
/api/guilds/:guildId/reaction-roles/:messageIdnow returns 500 for DB errors and 404 only when not found.handleDeletewraps deletion in try/catch and replies with an ephemeral error embed on failures.Migration
prisma migrate deploy.(guildId, threadId)rows fromguild_forum_threadsand rerun.Written for commit 8bb8542. Summary will update on new commits.
Summary by CodeRabbit
Bug Fixes
Tests