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

chore(refactor): refactored user schema to camelcasing #54

Closed

Conversation

prasanth7890
Copy link

@prasanth7890 prasanth7890 commented Nov 27, 2023

closes #44

👷🏻 Changes made

I rewrote the UserSchema and ReportProblemSchema to follow camelCase naming conventions for improved readability and consistency. Also updated instances in code where these schema models are referenced to reflect the case changes.

Summary by CodeRabbit

  • Refactor

    • Standardized naming conventions across the application by updating user-related fields to camelCase (e.g., userType, firstName, lastName, reportMessage).
  • Bug Fixes

    • Corrected case sensitivity issues in database queries to ensure consistent data retrieval.
  • Documentation

    • Updated internal documentation to reflect changes in naming conventions for user attributes.

Copy link

coderabbitai bot commented Nov 27, 2023

Walkthrough

The recent updates across various JavaScript and schema files in a Node.js application primarily involve standardizing the naming convention to camelCase for consistency and better readability. This includes changes to property names in route handlers and Mongoose schemas, aligning with common JavaScript practices.

Changes

File Path Change Summary
routes/.../Club.js
routes/.../Display.js
routes/.../Auth.js
routes/.../User.js
Updated query parameter and object properties from usertype to userType, and from firstname and lastname to firstName and lastName.
schema/.../ReportProblemSchema.js
schema/.../UserSchema.js
Renamed fields from usertype, firstname, lastname, and reportmessage to userType, firstName, lastName, and reportMessage.

Assessment against linked issues

Objective Addressed Explanation
Refactor user schema to use camel casing (#44) The changes in ReportProblemSchema.js and UserSchema.js reflect the camel casing standard as requested.

Poem

In the land of code, where the camelCase reigns,
A rabbit hopped through, making some gains.
Fields and properties, now neatly aligned,
With each keystroke, better code we find. 🐇💻✨


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hello @prasanth7890, thank you for raising a pull request.

Currently, the pull request is marked as https://github.com/MilanCommunity/Milan-Backend/labels/%F0%9F%9F%A3%20status%3A%20todo so please wait until the maintainers/owner review it and provide you with feedback/suggestions to proceed further.

Feel free to reach out to Tamal on Twitter, or drop a mail at [email protected] if you think that this pull request is of critical priority.

Give us a ⭐ to show some support
Happy OpenSource 🚀

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between a06c909 and 5f75f53.
Files selected for processing (6)
  • routes/club/Club.js (1 hunks)
  • routes/display/Display.js (1 hunks)
  • routes/user/Auth.js (3 hunks)
  • routes/user/User.js (3 hunks)
  • schema/user/ReportProblemSchema.js (1 hunks)
  • schema/user/UserSchema.js (1 hunks)
Files skipped from review due to trivial changes (2)
  • routes/display/Display.js
  • routes/user/User.js
Additional comments: 7
routes/club/Club.js (1)
  • 12-14: The change from usertype: "club" to userType: "club" aligns with the refactor to camelCase naming convention as described in the pull request summary.
routes/user/Auth.js (3)
  • 75-75: The cookie key has been correctly updated from usertype to userType to reflect the new camelCase naming convention.

  • 120-124: The properties firstName, lastName, and password have been correctly updated to camelCase in the UserData object, with password being renamed to newHashedPassword for clarity.

  • 173-173: The property userType has been correctly updated to camelCase when creating a new user in the /google/callback route.

schema/user/ReportProblemSchema.js (1)
  • 3-20: The changes to the ReportProblemSchema correctly update the field names to camelCase, which aligns with the JavaScript best practices for naming conventions.
schema/user/UserSchema.js (2)
  • 3-14: The changes to the UserSchema fields from snake_case or lowercase to camelCase are consistent with the pull request description and improve the readability and consistency of the codebase.

  • 1-14: Ensure that all database-related configurations, such as indexes and validation rules, are updated to reflect the new field names in the UserSchema.

@tamalCodes tamalCodes closed this Oct 18, 2024
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.

📂Other: user schema need to be refactored
2 participants