Skip to content

Simple guest book REST API built on golang that supports multiple endpoints.

License

Notifications You must be signed in to change notification settings

ttoktassynov/guestbook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple guest book

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.

Technology used

  • Golang 1.16.4
  • Mysql 8.0.25 (see guestbookdb.sql dump)
  • Postman (to test PUT and DELETE request methods)

Assumptions

  • 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

Models

Conceptual, Context and Data models

API

Add a guest to the guestlist

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 the guest list

GET /guest_list
response: 
{
    "guests": [
        {
            "name": "string",
            "table": int,
            "accompanying_guests": int
        }, ...
    ]
}

Guest Arrives

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"
}

Guest Leaves

When a guest leaves, all their accompanying guests leave as well.

DELETE /guests/name

Get arrived guests

GET /guests
response: 
{
    "guests": [
        {
            "name": "string",
            "accompanying_guests": int,
            "time_arrived": "string"
        }
    ]
}

Count number of empty seats

GET /seats_empty
response:
{
    "seats_empty": int
}

About

Simple guest book REST API built on golang that supports multiple endpoints.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages