CSC/ECE 517 Spring 2023 E2318: Reimplement Participants Controller: Difference between revisions
No edit summary |
No edit summary |
||
Line 7: | Line 7: | ||
The participants controller manages the participants across these courses and assignments by providing functionalities like listing all participants, adding a participant to a course or an assignment, updating the authorizations of a participant (can_submit, can_review, can_take_quiz), deleting a participant, inheriting participants from a course to an assignment, bequeath assignment participants to the corresponding course, changing the handle name of a participant in an assignment, and deleting a participant from an assignment. | The participants controller manages the participants across these courses and assignments by providing functionalities like listing all participants, adding a participant to a course or an assignment, updating the authorizations of a participant (can_submit, can_review, can_take_quiz), deleting a participant, inheriting participants from a course to an assignment, bequeath assignment participants to the corresponding course, changing the handle name of a participant in an assignment, and deleting a participant from an assignment. | ||
== Implementation == | |||
As part of the re-implementation, the objective is to employ an API-first approach while maintaining all the existing functionality in an efficient, robust and simple manner. Specifically for the participants controller, we've added seven different API endpoints to extend the current functionalities while modifying the code to support these APIs. The details for these endpoints can be found below. | |||
{| class="wikitable" style="width: 100%; | |||
! # !! Endpoint !! Description | |||
|- | |||
|1 | |||
|GET <code>/participants/index/:model/:id</code> | |||
|Returns a list of participants of an assignment or a course | |||
|- | |||
|2 | |||
|POST <code>/participants/:model/:id/:authorization</code> | |||
|Creates a participant in an assignment or a course | |||
|- | |||
|3 | |||
|POST <code>/participants/change_handle/:id</code> | |||
|Updates the participant's handle for an assignment | |||
|- | |||
|4 | |||
|POST <code>/participants/update_authorizations/:id/:authorization</code> | |||
|Updates the participant's permissions for an assignment or a course depending on the role | |||
|- | |||
|5 | |||
|DELETE <code>/participants/:id</code> | |||
|Deletes a participant from an assignment or a course | |||
|- | |||
|6 | |||
|GET <code>/participants/inherit/:id</code> | |||
|Copies existing participants from a course down to its assignment | |||
|- | |||
|7 | |||
|GET <code>/participants/bequeath/:id</code> | |||
|Copies existing participants from an assignment up to its course | |||
|} | |||
=== Index === | |||
'''Purpose''': Returns a list of participants of an assignment or a course | |||
'''Description''': This endpoint allows the user to request a list of all participants for the provided assignment ID or course ID. A success response renders a JSON with a list of participants that can be parsed by the front-end. | |||
'''Path''': <code>/participants/index/:model/:id</code> | |||
'''API method''': GET | |||
'''Parameters''': | |||
{| class="wikitable" style="width: 100%; | |||
! # !! Parameter !! Expected Value | |||
|- | |||
|1 | |||
|<code>:model</code> | |||
|One of these two strings: <code>['Assignment', 'Course']</code> | |||
|- | |||
|2 | |||
|<code>:id</code> | |||
|The unique identifier for an assignment or a course depending on the value of <code>:model</code> | |||
|} | |||
* '''Success response''' | |||
<pre> | |||
{ | |||
"model_object": model_object, | |||
"participants": participants, | |||
} | |||
status: :ok | |||
</pre> | |||
* '''Failure response''' | |||
<pre> | |||
{ | |||
error: "Missing or invalid required parameters" | |||
} | |||
status: :unprocessable_entity | |||
</pre> | |||
'''Changes''': | |||
<TBD> | |||
=== Create === | |||
'''Purpose''': Creates a participant in an assignment or a course | |||
'''Description''': | |||
'''Path''': <code>/participants/:model/:id/:authorization</code> | |||
'''API method''': POST | |||
'''Parameters''': | |||
'''Response''': | |||
'''Changes''': | |||
<TBD> | |||
=== Update Handle === | |||
'''Purpose''': Updates the participant's handle for an assignment | |||
'''Description''': | |||
'''Path''': <code>/participants/change_handle/:id</code> | |||
'''API method''': POST | |||
'''Parameters''': | |||
'''Response''': | |||
'''Changes''': | |||
<TBD> | |||
=== Update authorizations === | |||
'''Purpose''': Updates the participant's permissions for an assignment or a course depending on the role | |||
'''Description''': | |||
'''Path''': <code>/participants/update_authorizations/:id/:authorization</code> | |||
'''API method''': POST | |||
'''Parameters''': | |||
'''Response''': | |||
'''Changes''': | |||
<TBD> | |||
=== Delete === | |||
'''Purpose''': Deletes a participant from an assignment or a course | |||
'''Description''': | |||
'''Path''': <code>/participants/:id</code> | |||
'''API method''': DELETE | |||
'''Parameters''': | |||
'''Response''': | |||
'''Changes''': | |||
<TBD> | |||
=== Inherit === | |||
'''Purpose''': Copies existing participants from a course down to its assignment | |||
'''Description''': | |||
'''Path''': <code>/participants/inherit/:id</code> | |||
'''API method''': GET | |||
'''Parameters''': | |||
'''Response''': | |||
'''Changes''': | |||
<TBD> | |||
=== Bequeath === | |||
'''Purpose''': Copies existing participants from an assignment up to its course | |||
'''Description''': | |||
'''Path''': <code>/participants/bequeath/:id</code> | |||
'''API method''': GET | |||
'''Parameters''': | |||
'''Response''': | |||
'''Changes''': | |||
<TBD> | |||
== Test Plan == | == Test Plan == | ||
<TBD> | |||
== | |||
== Contributors == | |||
# Saksham Pandey (spandey5@ncsu.edu) | # Saksham Pandey (spandey5@ncsu.edu) | ||
# Devashish Vachhani (dvachha@ncsu.edu) | # Devashish Vachhani (dvachha@ncsu.edu) | ||
# Karthik K Jayakumar (kkunnum@ncsu.edu) | # Karthik K Jayakumar (kkunnum@ncsu.edu) | ||
Mentor: Rucha Kolekar (rbkoleka@ncsu.edu) | Mentor: Rucha Kolekar (rbkoleka@ncsu.edu) | ||
== Relevant Links == | |||
<TBD> |
Revision as of 01:52, 23 March 2023
Introduction
Expertiza is an Open Source Rails application which is used by instructors and students for creating assignments and submitting peer reviews. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and also review each other's assignments. Expertiza supports submissions across various document types, including URLs and wiki pages. The Source code of the application can be cloned from Github.
Background
In expertiza, there are three different types of users - normal users (typically students), administrators, super administrators. A normal user can participate in a course or an assignment or both. Courses and assignments are different entities in the system which allow enrollment of users. While a course is an independent entity, an assignment is part of a course.
The participants controller manages the participants across these courses and assignments by providing functionalities like listing all participants, adding a participant to a course or an assignment, updating the authorizations of a participant (can_submit, can_review, can_take_quiz), deleting a participant, inheriting participants from a course to an assignment, bequeath assignment participants to the corresponding course, changing the handle name of a participant in an assignment, and deleting a participant from an assignment.
Implementation
As part of the re-implementation, the objective is to employ an API-first approach while maintaining all the existing functionality in an efficient, robust and simple manner. Specifically for the participants controller, we've added seven different API endpoints to extend the current functionalities while modifying the code to support these APIs. The details for these endpoints can be found below.
# | Endpoint | Description |
---|---|---|
1 | GET /participants/index/:model/:id
|
Returns a list of participants of an assignment or a course |
2 | POST /participants/:model/:id/:authorization
|
Creates a participant in an assignment or a course |
3 | POST /participants/change_handle/:id
|
Updates the participant's handle for an assignment |
4 | POST /participants/update_authorizations/:id/:authorization
|
Updates the participant's permissions for an assignment or a course depending on the role |
5 | DELETE /participants/:id
|
Deletes a participant from an assignment or a course |
6 | GET /participants/inherit/:id
|
Copies existing participants from a course down to its assignment |
7 | GET /participants/bequeath/:id
|
Copies existing participants from an assignment up to its course |
Index
Purpose: Returns a list of participants of an assignment or a course
Description: This endpoint allows the user to request a list of all participants for the provided assignment ID or course ID. A success response renders a JSON with a list of participants that can be parsed by the front-end.
Path: /participants/index/:model/:id
API method: GET
Parameters:
# | Parameter | Expected Value |
---|---|---|
1 | :model
|
One of these two strings: ['Assignment', 'Course']
|
2 | :id
|
The unique identifier for an assignment or a course depending on the value of :model
|
- Success response
{ "model_object": model_object, "participants": participants, } status: :ok
- Failure response
{ error: "Missing or invalid required parameters" } status: :unprocessable_entity
Changes: <TBD>
Create
Purpose: Creates a participant in an assignment or a course
Description:
Path: /participants/:model/:id/:authorization
API method: POST
Parameters:
Response:
Changes: <TBD>
Update Handle
Purpose: Updates the participant's handle for an assignment
Description:
Path: /participants/change_handle/:id
API method: POST
Parameters:
Response:
Changes: <TBD>
Update authorizations
Purpose: Updates the participant's permissions for an assignment or a course depending on the role
Description:
Path: /participants/update_authorizations/:id/:authorization
API method: POST
Parameters:
Response:
Changes: <TBD>
Delete
Purpose: Deletes a participant from an assignment or a course
Description:
Path: /participants/:id
API method: DELETE
Parameters:
Response:
Changes: <TBD>
Inherit
Purpose: Copies existing participants from a course down to its assignment
Description:
Path: /participants/inherit/:id
API method: GET
Parameters:
Response:
Changes: <TBD>
Bequeath
Purpose: Copies existing participants from an assignment up to its course
Description:
Path: /participants/bequeath/:id
API method: GET
Parameters:
Response:
Changes: <TBD>
Test Plan
<TBD>
Contributors
- Saksham Pandey (spandey5@ncsu.edu)
- Devashish Vachhani (dvachha@ncsu.edu)
- Karthik K Jayakumar (kkunnum@ncsu.edu)
Mentor: Rucha Kolekar (rbkoleka@ncsu.edu)
Relevant Links
<TBD>