feat(notes): enforce max length limits on note title and content#109
feat(notes): enforce max length limits on note title and content#109sricharan12-hub wants to merge 1 commit into
Conversation
Notes had no maximum-length limits on title or content, so arbitrarily large notes could be submitted and stored. - Model (Note.js): add maxlength (title 100, content 10000) with clear messages, and trim the title. - Controllers (createNote / updateNote): reject over-length title/content with a friendly 400 before saving; update already runs validators. - Frontend (CreatePage, NoteDetailPage): cap the title/content inputs via maxLength and show a live character counter. Limits: title <= 100 characters, content <= 10000 characters. Closes niharika-mente#84
|
Warning Review limit reached
Next review available in: 19 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Overview
Adds maximum-length validation for a note's
titleandcontenton both thebackend (authoritative) and the frontend (UX). Previously neither had any upper
bound, so arbitrarily large notes could be submitted and stored.
Closes #84
Limits: title ≤ 100 characters, content ≤ 10000 characters.
Changes
Backend
models/Note.js— addmaxlengthtotitle(100) andcontent(10000) withclear messages, and
trim: trueon the title.controllers/notesController.js—createNote/updateNotereject over-lengthtitle/content with a friendly
400message before saving (rather than surfacinga raw Mongoose validation error). Length constants mirror the model.
updateNotealready runs
runValidators: true.Frontend
CreatePage.jsxandNoteDetailPage.jsx— cap the title/content inputs viamaxLengthand show a livecurrent/maxcharacter counter under each field.Acceptance criteria
400message.maxlengthfor both fields.maxLength(with a counter).Testing
eslintpasses on both edited pages;node --checkpasses on the model and controller.validateSync:" hello "→ trimmed to"hello".Title cannot exceed 100 characters.