-
Notifications
You must be signed in to change notification settings - Fork 9
API
Samyuth edited this page Jul 29, 2022
·
3 revisions
A multipurpose route to get requests that can filter by the status and state. Optionally can get a specified number of requests, can choose requests only made by a certain user, and can send an abbreviated version of the request.
@route: GET api/request?number&abbreviated&user
@access Public
@desc: Gets a request, optionally can have query strings
number (the number of requests you want to retrieve)
abbreviated (boolean flag to say only certain data)
user (requests made by a certain user)
@requires: Request body is of the following format
{
queries: [{ status: String, state: String }]
}
Must have a queries field, within query any objects must have status and state, status must be in a valid status state pair.
@returns: A list of requests specified by the query string
[
{request A},
{request B},
...
]
@throws: 400 if the statuses and states are invalid/not string/don't exist in the request body or url paramaters are weird
@route: GET api/request/suggested?request_id
@access: Private
@desc: Gets a list of suggested tutors for a student
@requirements: Must be in OPENED or CHECKING state
The route that start lifecycle, with a student opening a request
@route: POST api/request/
@access: Private
@description: Student opens a requests
@modifies: create the request
This route allows students to ping tutors if they are in an opened or checking state
@route: POST api/request/ping?tutor_id&request_id
@access: Private
@description: Student opens a requests
@modifies: Adds to the list of pinged tutors, changes to state to CHECKING
If a tutor was pinged they then accept the request
@route: POST api/request/tutor/accept/?request_id
@access: Private
@description: Tutor chooses to accept a request that they were pinged for
@modifies: Adds to the accepted tutors list
Once a tutor accepts a request a student can choose that tutor as the tutor they would like to proceed with
@route: POST api/request/student/select?tutor_id
@access: Private
@description: Student selects a tutor to proceed with
@modifies: Sets the selected tutor field, changes state to ASSIGNED
Tutor confirms if they would like to proceed with a request
@route: POST api/request/tutor/confirm?request_id
@access: Private
@description: Tutor does a final confirmation for if they would like to proceed with the request
@modifies: State change to FULFILLED
@route: POST api/request/tutor/rate?request_id
@access: Private
@description: Tutor rates a student
@modifies: Adds a tutor rating
@route: POST api/request/student/rate?request_id
@access: Private
@description: Student rates a tutor
@modifies: Adds a student rating
@route: POST api/request/close?request_id
@access: Private
@description: Student finally closes the request after it has been rated
@requirements: Request must have both student and tutor rating
@modifies: Changes status close
You can edit a request if you are in an opened/checking state
@route: PUT api/request?request_id
@access: Private
@description: Student edits their request
@requirements: Must be OPENED or CHECKING state, request_id must be a valid request in the DB
@modifies: Alters the primary request data
@route: DELETE api/request/tutor/deny?request_id
@access: Private
@description: Tutor denies an incoming request
@modifies: Moving the tutor to the denied, removes from accepted tutors
@route: DELETE api/request/student/cancel?request_id
@access: Private
@description: Student moves from a state to a cancel state
@modifies: Prepends 'CANCELLED' to the state
@route: DELETE api/request/tutor/cancel?request_id
@access: Private
@description: State transition for when the tutor chooses to cancel their acceptance
@modifies: Sets the selected tutor feild to null, adds to cancelled tutor list, if tutor is cancelling accptence remove from accepted tutors list