-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #158 from RA341/add-users
added bulk enroll/drop students
- Loading branch information
Showing
4 changed files
with
207 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,7 +80,7 @@ Router.get( | |
extractOwnerByPathParam('userId'), | ||
isAuthorized('courseViewAll', 'enrolled'), | ||
asInt('userId'), | ||
UserCourseController.detailByUser | ||
UserCourseController.detailByUser, | ||
) | ||
|
||
/** | ||
|
@@ -102,6 +102,104 @@ Router.get( | |
Router.post('/', validator, UserCourseController.post) | ||
// TODO: userCourseEditAll eventually. For now, allow self enroll | ||
|
||
|
||
/** | ||
* @swagger | ||
* /courses/{courseId}/students/add: | ||
* put: | ||
* summary: Add multiple students to a course | ||
* tags: | ||
* - UserCourses | ||
* responses: | ||
* 200: | ||
* content: | ||
* application/json: | ||
* schema: | ||
* type: object | ||
* properties: | ||
* success: | ||
* type: string | ||
* description: Array of successfully enrolled users as a string | ||
* example: '["[email protected] enrolled successfully"]' | ||
* failed: | ||
* type: string | ||
* description: Array of failed enrollments with error messages as a string | ||
* example: '["[email protected]: Error: User already enrolled in course", "[email protected] not found"]' | ||
* required: | ||
* - success | ||
* - failed | ||
* parameters: | ||
* - name: courseId | ||
* in: path | ||
* required: true | ||
* schema: | ||
* type: integer | ||
* requestBody: | ||
* description: A list of emails in a json array | ||
* content: | ||
* application/json: | ||
* schema: | ||
* type: object | ||
* properties: | ||
* users: | ||
* type: array | ||
* items: | ||
* type: string | ||
* format: email | ||
* required: | ||
* - users | ||
*/ | ||
Router.post('/students/add', asInt('courseId'), isAuthorized('courseViewAll'), UserCourseController.addStudents) | ||
|
||
/** | ||
* @swagger | ||
* /courses/{courseId}/students/drop: | ||
* put: | ||
* summary: Drop multiple students from a course | ||
* tags: | ||
* - UserCourses | ||
* responses: | ||
* 200: | ||
* content: | ||
* application/json: | ||
* schema: | ||
* type: object | ||
* properties: | ||
* success: | ||
* type: string | ||
* description: Array of successfully dropped students as a string | ||
* example: '["[email protected] dropped successfully"]' | ||
* failed: | ||
* type: string | ||
* description: Array of failed drops with error messages as a string | ||
* example: '["[email protected] not found"]' | ||
* required: | ||
* - success | ||
* - failed | ||
* parameters: | ||
* - name: courseId | ||
* in: path | ||
* required: true | ||
* schema: | ||
* type: integer | ||
* requestBody: | ||
* description: A list of emails in a json array | ||
* content: | ||
* application/json: | ||
* schema: | ||
* type: object | ||
* properties: | ||
* users: | ||
* type: array | ||
* items: | ||
* type: string | ||
* format: email | ||
* required: | ||
* - users | ||
*/ | ||
Router.post('/students/drop', asInt('courseId'), isAuthorized('courseViewAll'), UserCourseController.dropStudents) | ||
|
||
|
||
/** | ||
* @swagger | ||
* /course/:courseId/users-courses/{id}: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters