Skip to content

feat: improve user schema validation and serialization#399

Open
jikrana1 wants to merge 1 commit into
niharika-mente:mainfrom
jikrana1:improve-user-schema-validation-security
Open

feat: improve user schema validation and serialization#399
jikrana1 wants to merge 1 commit into
niharika-mente:mainfrom
jikrana1:improve-user-schema-validation-security

Conversation

@jikrana1

Copy link
Copy Markdown
Contributor

🛠 Pull Request Template

📌 Related Issue

Fixes: #388


🔍 Describe your changes?

  • Added email format validation to prevent invalid email addresses.
  • Added a maximum length constraint for the name field.
  • Configured googleId and githubId with unique and sparse indexes to avoid duplicate OAuth identifiers.
  • Added a toJSON transform to exclude sensitive fields from API responses.
  • Improved overall user schema structure for better validation and production readiness.
  • Maintained backward compatibility with the existing authentication flow.

🧪 Checklist

Please check all that apply:

  • I have tested my changes locally.
  • I have followed the project's code style and guidelines.
  • I have added necessary comments and documentation.
  • The code compiles and runs without errors.

Program:

SSOC 2026


🗒️ Additional Notes (Optional)

  • These changes improve schema validation and data consistency.
  • Sensitive fields are excluded from JSON responses for safer API serialization.
  • Existing login and authentication flow remain unaffected.

Thank you for contributing!


@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the niharika-mente's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Aamod-Dev Aamod-Dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The user schema validation improvements (email regex, name maxlength, sparse indexes, toJSON transform) look good — they improve data integrity and security.

However, the FRONTEND/package-lock.json changes are concerning: you have removed peer: true from many entries (chakra, emotion, react, eslint, vitest, testing-library) and added it to others. This can break dependency resolution for contributors and in CI. Please revert the lockfile to its original state — the schema changes do not require any lockfile modifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve User model for production readiness (validation & security)

2 participants