[POST] Generate Timetables From Classes #218
Labels
Status: Completed
Type: Feature
user story
A brief explanation of a functionality or an interaction with the system, from a user's perspective
Summary
As a
student
, I should be able to get all possible generated timetables, so that I can choose one for my semester.Acceptance Criteria
GIVEN an
student
is requesting all possible timetables in the appWHEN the app hits the
/timetables/generate
endpoint with a valid POST request containing body parameters:classes
array, where each item is a:num_of_subjects
, number of unique subjects in a timetable.THEN the app should receive a status
200
AND in the response, the following information should be returned:
Sample Request/Sample Response
Resources
Dev Notes
This is going to return all possible timetables for the specified classes. This endpoint is going to be accessible and work the same way for the admin as well.
Testing Notes
Scenario 1: POST request is successful
GIVEN a
student
is requesting all possible timetables in the appWHEN the app hits the
/timetables/generate
endpoint with a valid POST requestTHEN the app should receive a status 200
AND the body should be an array
AND the first item of the array should be an object containing the following fields:
AND the key
classes
should be an arrayAND the first item of the array should be an object containing the following fields:
AND the key
classroom
should be an object containing the following fields:AND the key
campus
should be an object containing the following fields:AND the key
subject
should be an object containing the following fields:AND the key
teacher
should be an object containing the following fields:AND the keys
timeslot_1
andtimeslot_2
should be objects containing the following fields:Scenario 2: POST request is unsuccessful due to no possible timetables
GIVEN a
student
is requesting all possible timetables in the appWHEN the app hits the
/timetables/generate
endpoint with a valid POST requestAND the
classes
in the body result in 0 timetables due to conflictsTHEN the app should receive a status
404
AND the response headers'
code
parameter should contain "NotFoundException"Scenario 3: POST request is incorrect
GIVEN a
student
is requesting all possible timetables in the appWHEN the app hits the
/timetables/generate
endpoint with a POST requestAND the body contains an incorrect key
THEN the app should receive a status
422
AND the response headers'
code
parameter should contain "InvalidPropertiesException"AND the response headers'
data
parameter should contain the name of the invalid parametersScenario 4: POST request is unauthorized
GIVEN a
student
is requesting all possible timetables in the appWHEN the app hits the
/timetables/generate
endpoint with a valid POST requestAND the request contains no authorization token
THEN the app should receive a status
401
UnauthorizedAND the response headers'
code
parameter should contain "TokenMissingException"The text was updated successfully, but these errors were encountered: