Microservice responsible for reserving space among Revature's digital and physical facilities. Part of the AssignForce suite
This repository requires one environment variable AUTH_SERVER for deployment
It should be in the form of ${name-of-authorization-service-here}/verify. The authorization service
should also be deployed on the same K8 cluster so that discovery is possible.
All requests should have an Authorization header with a valid JWT, and will be rejected
otherwise. Any request that does not have a JWT will be returned a 401 UNAUTHORIZED.
Most requests return a reservation object or list of reservation objects, each of which
will be in this form.
{
"reservationId": "Numeric ID",
"reserver": "Email string",
"startTime": "Unix Epoch timestamp as number",
"endTime": "Unix Epoch timestamp as number",
"status": "reserved | cancelled",
"roomId": "Numeric Room Id from path",
"title": "Title of the Reservation"
}POST /reservations
Expected Body:
{
"startTime": "Unix Epoch timestamp as number",
"endTime": "Unix Epoch timestamp as number",
"roomId": "ID of a valid room in the database",
"title": "Optional title, will be made reserver email if none is given"
}Possible returns:
201with full reservation return body404 NOT FOUNDif invalid or no room ID is provided406 NOT ACCEPTABLEif startTime is after endTime409 CONFLICTif given times conflict with times in the database
GET /reservations?start=number&end=number&reserver=string&status=string&roomId=number
Gets all reservations. Users can filter based on the optional parameters. Optional parameters include:
start (Unix epoch time)Set a floor for reservation timesend (Unix epoch time)Set a ceiling for reservation timesreserver (Email string)Search for only reservations made by a specific reserverstatus (Status string)Search for only reservations with a given status. Valid statuses includereservedandcancelled.roomId (Integer)Search for only reservations within a given room.
It is recommended that some time range is always given when making calls to this endpoint, as not doing so will slow down response times considerably.
Possible returns:
200with list of reservations bodies406 NOT ACCEPTABLEif start is after end
GET /reservations/{reservationId}
Gets reservation with reservationId.
Possible returns:
200with full reservation return body404 NOT FOUNDif invalid reservation ID is provided in the path
PATCH /reservations/{reservationId}?action=cancel
This method either, changes the times for a reservation in a room, or cancels a reservation in the database if the action query param is set to "cancel". If action is set to cancel, the body is ignored, if the action is set to anything else, action is ignored. All the body elements for updating are optional and if any are omitted, the old value will persist.
Expected Body:
{
"startTime": "Unix Epoch timestamp as number (Optional)",
"endTime": "Unix Epoch timestamp as number (Optional)",
"title": "Title string to be updated to (Optional)"
}Possible returns:
200with full reservation return body404 NOT FOUNDif invalid reservation ID is provided406 NOT ACCEPTABLEif startTime is after endTime403 FORBIDDENif user is attempting to change a reservation that isn't theirsadminusers can both cancel and update other users reservations. Updating another user's reservation will transfer ownership of the reservation to the admin user. This may need change in the future.
409 CONFLICTif the new times have a conflict with another reservation