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

BE - Add Pronouns and Gender Fields to Profile Schema #65

Open
4 tasks
sanjaysah101 opened this issue Sep 19, 2024 · 0 comments
Open
4 tasks

BE - Add Pronouns and Gender Fields to Profile Schema #65

sanjaysah101 opened this issue Sep 19, 2024 · 0 comments

Comments

@sanjaysah101
Copy link
Collaborator

Description:

We need to enhance the user profile schema by adding fields for gender and pronouns. The pronouns will be derived from the selected gender on the server side, allowing users to provide only their gender. Additionally, gender will be kept private while pronouns will be public.

Key Requirements:

1. Schema Update:

  • Add the following fields to the profile schema:
    • gender: z.enum(['male', 'female', 'non-binary', 'other']),
    • pronouns: z.enum(['he/him', 'she/her', 'they/them', 'other']) (derived from gender).

2. Synchronization Logic:

  • Implement logic on the server to set the pronouns field based on the gender:
    • If gender is male, set pronouns to he/him.
    • If gender is female, set pronouns to she/her.
    • If gender is non-binary, set pronouns to they/them.
    • If gender is other, allow any pronouns (he/him, she/her, they/them, other).

3. Profile Visibility:

  • Ensure that the gender field is private and not visible to users viewing another profile.
  • Allow the pronouns field to be public and visible in profile responses.

4. Update Aggregation Pipeline:

  • Modify the MongoDB aggregation pipeline in the profile retrieval logic to:
    • Exclude the gender field for other users.
    • Include the pronouns field when a user views another user's profile.

5. Testing:

  • Write unit tests to cover the following scenarios:
    • Verify that the correct pronouns are derived based on the gender.
    • Ensure that gender is not visible when retrieving another user's profile.
    • Confirm that pronouns are publicly visible.

Tasks:

  • Update the profile schema to include gender and pronouns.
  • Implement server-side logic to synchronize pronouns with gender.
  • Update the MongoDB aggregation pipeline in the profile retrieval logic.
  • Write unit tests for all scenarios mentioned above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant