-
Notifications
You must be signed in to change notification settings - Fork 0
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 #231 from COS301-SE-2024/chore/backend/get-rooms/b…
…ooking-endpoint chore: rewrote some backend logix and added some new endpoints
- Loading branch information
Showing
9 changed files
with
574 additions
and
265 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,14 +12,20 @@ The API also allows you to retrieve information about these resources. | |
- [Base URL](#base-url) | ||
- [Api](#api) | ||
- [Resources](#resources) | ||
- [BookRoom](#BookRoom) | ||
- [ViewBookings](#ViewBookings) | ||
- [CancelBooking](#CancelBooking) | ||
- [CheckIn](#CheckIn) | ||
- [Book Room](#BookRoom) | ||
- [View Bookings](#ViewBookings) | ||
- [View Rooms](#ViewRooms) | ||
- [Cancel Booking](#CancelBooking) | ||
- [Check In](#CheckIn) | ||
- [Get Users](#Get-users) | ||
- [Get Notifications](#Get-notifications) | ||
- [Get push tokens](#Get-push-tokens) | ||
- [UpdateSecuritySettings](#UpdateSecuritySettings) | ||
- [Get User Details](#GetUserDetails) | ||
- [Update User Details](#UpdateUserDetails) | ||
- [Get Security Settings](#GetSecuritySettings) | ||
- [Update Notification Settings](#UpdateNotificationSettings) | ||
- [Get Notification Settings](#GetNotificationSettings) | ||
|
||
## Api | ||
|
||
|
@@ -127,8 +133,63 @@ If there are any errors during the process, appropriate error messages are retur | |
- **Content** | ||
|
||
```json copy | ||
{ | ||
"emails": "string" | ||
{ | ||
"operator": "eq", // eq, ne, gt, gte, lt, lte, in, nin default to eq | ||
"filter": { | ||
"email": "[email protected]" // the email is required | ||
}, | ||
"order_asc": "creator", // column to sort in ascending order | ||
"order_desc": "floor", // column to sort in descending order | ||
"projection": ["floor"], // this is which columns you want returned | ||
"limit": 50, // default is 50 and is the maximum | ||
"page": 1 // default is 1, but can be incremented to get the next page | ||
} | ||
``` | ||
|
||
**Success Response** | ||
|
||
- **Code:** 200 | ||
- **Content:** `{ "status": 200, "message": "Successfully fetched bookings!", "data": null }` | ||
|
||
**Error Response** | ||
|
||
- **Code:** 400 | ||
- **Content:** `{ "status": 400, "message": "Invalid request payload", "error": {"code":"BAD_REQUEST","details":null,"message":"Expected Email Address"}, }` | ||
|
||
|
||
**Error Response** | ||
|
||
- **Code:** 500 | ||
- **Content:** `{ "status": 500, "message": "Failed to get bookings", "error": {"code":"INTERNAL_SERVER_ERROR","details":"Failed to get bookings","message":"Failed to get bookings"} }` | ||
|
||
### View Rooms | ||
|
||
This endpoint is used to view all rooms in the Occupi system. | ||
Upon a successful request, a list of all rooms is returned. | ||
|
||
- **URL** | ||
|
||
`/api/view-rooms` | ||
|
||
- **Method** | ||
|
||
`GET` | ||
|
||
- **Request Body** | ||
|
||
- **Content** | ||
|
||
```json copy | ||
{ | ||
"operator": "eq", // eq, ne, gt, gte, lt, lte, in, nin default to eq | ||
"filter": { | ||
"floorNo": 3 // this is a filter to filter by | ||
}, | ||
"order_asc": "description", // column to sort in ascending order | ||
"order_desc": "floor", // column to sort in descending order | ||
"projection": ["floor"], // this is which columns you want returned | ||
"limit": 50, // default is 50 and is the maximum | ||
"page": 1 // default is 1, but can be incremented to get the next page | ||
} | ||
``` | ||
|
||
|
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
Oops, something went wrong.