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

Invite Learner API #77

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

Invite Learner API #77

wants to merge 15 commits into from

Conversation

Astoriaaaa
Copy link
Collaborator

@Astoriaaaa Astoriaaaa commented Nov 5, 2024

Invite Learner

Implementation description

  • A new Learner Schema was created which just extends the User Schema but has an additional facilitator parameter (since each learner is linked to a facilitator)
  • When the facilitator creates the learner, a post request is sent with learner details, then the learner is added to the database and a verification email is sent to the learner.
  • new function createLearner is added to in userService which adds the user to firebase and mongoDB
  • new function sendLearnerInvite is added in authService which sends verification email to learner

Steps to test

  1. Log in as a facilitator to get your auth token
  2. Go to postman and create a POST request:
    2
    make sure you paste your auth token
  3. Go to MongoDBCompass and you should see an array of learners associated your facilitator id
    2

4.There should be a verification email sent to the learner you invited
3

What should reviewers focus on?

  • The facilitator id was initially fetched from firebase, however that led to mongoDB object errors so to get around this, the facilitator id is received from the body of the post request. Is this okay in terms of good code design? (After, Before)
    5

It’s cut off in the screenshot but the second parameter of createLearner was initially id

Checklist

  • My PR name is descriptive and in imperative tense
  • My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits
  • I have run the appropriate linter(s)
  • I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR

Copy link
Collaborator

@carolynzhang18 carolynzhang18 left a comment

Choose a reason for hiding this comment

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

everything looks awesome!! 💯💯💯

@ji-mmyliu ji-mmyliu changed the title Jimmy/invite learner Invite Learner API Nov 19, 2024
Copy link
Collaborator

@jasondsouza35 jasondsouza35 left a comment

Choose a reason for hiding this comment

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

this is nothing short of fantastic!
image

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.

4 participants