This is a guest book for organizing the party and managing tables seats. When the party begins, guests will arrive with an entourage. This party may not be the size indicated on the guest list. However, if it is expected that the guest's table can accommodate the extra people, then the whole party should be let in. Otherwise, they will be turned away. Guests will also leave throughout the course of the party. Note that when a guest leaves, their accompanying guests will leave with them.
- Golang 1.16.4
- Mysql 8.0.25 (see guestbookdb.sql dump)
- Postman (to test PUT and DELETE request methods)
- All reservations, i.e. adding guests to the guest list, happen before guests arrive.
- Get arrived guests will only return those guests who are arrived and present at the party
- All reservations are done subsequently, i.e. no concurrent requests to the tables table, which would create data race
- All guests have unique names
- All reservations are valid even if guests leave the party in the middle
If there is insufficient space at the specified table, then an error should be thrown.
POST /guest_list/name
body:
{
"table": int,
"accompanying_guests": int
}
response:
{
"name": "string"
}
GET /guest_list
response:
{
"guests": [
{
"name": "string",
"table": int,
"accompanying_guests": int
}, ...
]
}
A guest may arrive with an entourage that is not the size indicated at the guest list. If the table is expected to have space for the extras, allow them to come. Otherwise, this method should throw an error.
PUT /guests/name
body:
{
"accompanying_guests": int
}
response:
{
"name": "string"
}
When a guest leaves, all their accompanying guests leave as well.
DELETE /guests/name
GET /guests
response:
{
"guests": [
{
"name": "string",
"accompanying_guests": int,
"time_arrived": "string"
}
]
}
GET /seats_empty
response:
{
"seats_empty": int
}