Let's connect this page to the API! The API endpoint to use to update PATCH /language/course.
Steps for Changing Privacy of Course:
Add a is_private and code field to the CourseDetails MongoDB model in api/src/models/language.js. Default values:is_private is True and code is a random 5 digit alphanumeric string.
Update all API unit tests that will get affected by this field update.
Use the CourseDetails saved in Redux to set the default private/public dropdown and the passcode on the Course Settings page. You'll have to add the default values of is_private and code to the initialState in client/src/redux/slices/language.slice.js.
For updating the field, call PATCH /language/course from the frontend, and only pass in the is_private and code field.
Steps for Deleting a Course
Create an endpoint called DELETE /language/course. Make sure to delete all course data associated with it, from text in MongoDB to files in AWS.
Edge Cases:
If a user switches from public to private or vice-versa, don't clear the code. Keep it saved in the database/Redux, and we'll just reuse that value when the user switches back to private.
Goals
Let's connect this page to the API! The API endpoint to use to update
PATCH /language/course
.Steps for Changing Privacy of Course:
is_private
andcode
field to the CourseDetails MongoDB model inapi/src/models/language.js.
Default values:is_private
is True andcode
is a random 5 digit alphanumeric string.private/public
dropdown and the passcode on the Course Settings page. You'll have to add the default values ofis_private
andcode
to the initialState inclient/src/redux/slices/language.slice.js
.PATCH /language/course
from the frontend, and only pass in theis_private
andcode
field.Steps for Deleting a Course
DELETE /language/course
. Make sure to delete all course data associated with it, from text in MongoDB to files in AWS.Edge Cases: