Skip to content

fix: remove client-supplied rating, dead code, and deletePrompt rollback - #2

Open
Ahmedfurkhan wants to merge 1 commit into
clbarry:mainfrom
Ahmedfurkhan:fix
Open

fix: remove client-supplied rating, dead code, and deletePrompt rollback#2
Ahmedfurkhan wants to merge 1 commit into
clbarry:mainfrom
Ahmedfurkhan:fix

Conversation

@Ahmedfurkhan

Copy link
Copy Markdown

Hey Carey and Julia! Just finished reviewing Prompt Explore and honestly it was a great experience the codebase is really clean and well thought out. The moderation workflow especially stood out, super smart to use a recently_deleted collection instead of hard deleting. I caught a couple of small bugs during the review (fake rating injection on create and a data consistency edge case in deletePrompt) and submitted a fix PR. Overall awesome work, you can tell a lot of effort went into this. Really enjoyed reviewing it!

What changed

routes/create.js

  • Removed rating from req.body destructuring
  • New prompts now always initialize with { 1:0, 2:0, 3:0, 4:0, 5:0 } server-side

db/promptDB.js

  • deletePrompt: added rollback if deleteOne fails after archiving
  • Removed commented-out local MongoDB URI (line 16)

Why
These were caught during peer code review. No functional behaviour
changes for the happy path only edge case correctness and security.

Reviewer notes

  • No schema/migration changes needed
  • No frontend changes
  • Safe to merge directly into main``

Future upgrades you can do for the application :

  1. Copy Button
    One-click copy on every prompt card. Most-used feature for real users — they come to find a prompt and paste it somewhere.

  2. User Accounts
    Right now anyone can delete anything. A simple session-based auth would let you track who submitted what and protect prompts from random deletion.

  3. Prompt History / Versioning
    When a moderator edits a prompt, save the original. Let users see what changed and why.

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