Skip to content

Add feedback form with rate limiting - #530

Open
krishitag wants to merge 1 commit into
CodeChefVIT:stagingfrom
krishitag:fix/issue-379-feedback-form
Open

Add feedback form with rate limiting#530
krishitag wants to merge 1 commit into
CodeChefVIT:stagingfrom
krishitag:fix/issue-379-feedback-form

Conversation

@krishitag

Copy link
Copy Markdown
Contributor

Fixes #379.

  • Added a Feedback modal accessible from the navbar (matches the existing Request Paper modal's structure and styling)
  • New /api/feedback route, service layer, and Mongoose model — validates message (required) and email (optional, format-checked)
  • Rate limited to 5 submissions per 15 minutes, reusing the existing Upstash Redis rate-limiting pattern used for paper requests and uploads

Verified with tsc --noEmit, pnpm build, and pnpm lint — all pass clean.

Fixes CodeChefVIT#379. Adds a Feedback modal accessible from the navbar (all 3
responsive layouts), backed by a new /api/feedback route, service
layer, and Mongoose model. Rate limited to 5 submissions per 15
minutes via the same Upstash Redis pattern used for paper requests
and uploads.
import { CustomError } from "@/lib/utils/error";

const MAX_MESSAGE_LENGTH = 2000;
const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: we have zod installed in this codebase and we can use it to handle message trimming, required validation, message length and appropriate error handling.

Comment thread src/components/Navbar.tsx

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

add a screenshot. will be easier to see whats happening

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.

Feedback Form

2 participants