Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance Mongoose Schemas: Improved Validation and Security #351

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

smog-root
Copy link
Contributor

@smog-root smog-root commented Nov 3, 2024

Closes #349

This pull request introduces enhancements and optimizations to several Mongoose schema files within the project, including blog.js, contact.js, feedback.js, newsletter.js, profile.js, project.js, user.js, and avatar.js. The changes aim to improve data validation, security, and overall schema clarity.

This PR deserves level3, Kindly review it and add the level accordingly! @Anuj3553

Changes Made:

blog.js

  • Added a regex pattern to the email field for validation.
  • Introduced a category field for better classification of blog posts.

contact.js

  • Enhanced email validation using a regex pattern.
  • Trimmed unnecessary whitespace for fields to ensure cleaner data.

feedback.js

  • Included basic email validation.
  • Trimmed fields to prevent leading and trailing spaces.
  • Specified validation for rating to ensure it falls within a defined range.

newsletter.js

  • Added email validation regex for the email field.
  • Introduced optional fields for subscription date and status.

profile.js

  • Added validation for the email, phone, and social links.
  • Introduced a role field to handle user roles (user/admin).
  • Clarified the image field to imageUrl for better understanding.
  • Incorporated timestamps for tracking creation and updates.

project.js

  • Renamed image field to imageUrl for clarity.
  • Added validation for gitHubLink and youTubeLink.
  • Introduced a status field to track the project state (In Progress, Completed).

user.js

  • Added regex for email validation.
  • Enforced password hashing requirement and set a minimum length.
  • Renamed image field to imageUrl for clarity.
  • Included optional role field to differentiate user access levels.
  • Incorporated timestamps for better record-keeping.

avatar.js

  • Renamed the image field to imageUrl for clarity.
  • Made the imageUrl field required and added validation regex.
  • Added timestamps to track avatar creation and updates.

Copy link

netlify bot commented Nov 3, 2024

👷 Deploy request for bitbox-in accepted.

Name Link
🔨 Latest commit 38a2f11
🔍 Latest deploy log https://app.netlify.com/sites/bitbox-in/deploys/6726c67451942f000877048d

Copy link

github-actions bot commented Nov 3, 2024

Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. In the meantime, please ensure that your changes align with our chaotic CONTRIBUTING.md. If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊

@Anuj3553 Anuj3553 self-requested a review November 4, 2024 13:45
@Anuj3553 Anuj3553 added gssoc-ext Extended contribution for GSSoC hacktoberfest-accepted Eligible contribution for Hacktoberfest rewards level2 Intermediate-level contribution or task hacktoberfest Open-source contribution during October for GSSoC labels Nov 4, 2024
@Anuj3553 Anuj3553 merged commit 2dcfbf8 into Bitbox-Connect:main Nov 4, 2024
1 of 6 checks passed
@Anuj3553
Copy link
Collaborator

Anuj3553 commented Nov 4, 2024

Well done @smog-root

Copy link

github-actions bot commented Nov 4, 2024

🎉🎉 Thank you for your contribution! Your PR #351 has been merged! 🎉🎉

@smog-root
Copy link
Contributor Author

@Anuj3553 I have edited lot of files!! Can you upgrade it to level3?!

@Anuj3553
Copy link
Collaborator

Anuj3553 commented Nov 4, 2024

@Anuj3553 I have edited lot of files!! Can you upgrade it to level3?!

Ohk

@Anuj3553 Anuj3553 added level3 Advanced or complex contribution/task and removed level2 Intermediate-level contribution or task labels Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gssoc-ext Extended contribution for GSSoC hacktoberfest Open-source contribution during October for GSSoC hacktoberfest-accepted Eligible contribution for Hacktoberfest rewards level3 Advanced or complex contribution/task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants