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

[JOHN | DONATELLO] ADMIN CLASS ENROLLMENTS #71

Open
3 tasks
lillian-tran opened this issue Jan 19, 2025 · 0 comments
Open
3 tasks

[JOHN | DONATELLO] ADMIN CLASS ENROLLMENTS #71

lillian-tran opened this issue Jan 19, 2025 · 0 comments
Assignees
Milestone

Comments

@lillian-tran
Copy link
Collaborator

lillian-tran commented Jan 19, 2025

Task Description:

YAY ADMIN ENROLLING STUDENTS IN CLASSES!
We want admin users to have the ability to enroll students in classes just in case there are technical difficulties. Log into the admin account (find the account with the privilege field set to “admin” in the Mongo users collection), which will take you to the admin page. On the admin page (AdminView.jsx), add a section containing a form with two input fields. The first should get the student’s email and the second should be the ID of the class (which will be the class’s MongoDB ID). When the form is submitted, the student should now be enrolled in the class! Make sure that the form can only be submitted when all the fields are filled out.
To make your life easier, most of this ticket should be done using pre-existing components and endpoints like the form components and enrollment endpoints. Note that the enrollment endpoint takes a student’s MongoDB ID and not their email, so you will need to first fetch the student object from the database given the email then get the student ID from that (you can use the getUser() function for this!) We also want to make sure that only students can be enrolled in classes, so if the student ID doesn’t belong to a student send an error message!

Acceptance Criteria:

  • Did you link the ticket/issue number with your branch using the pull request template?
  • When the form is submitted with the required information, does the student’s enrolledClasses array contain the new class’s MongoDB ObjectID in the database?
  • Does the student’s ID also update in the class’s roster array?

References and Resources:

MongoDB collection commands: https://www.mongodb.com/docs/manual/reference/method/js-collection/
Mongo Updating Documents: https://www.mongodb.com/docs/manual/tutorial/update-documents/

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

No branches or pull requests

3 participants