https://github.com/janearc/bourdain
take-home exercise for stephen
https://github.com/janearc/bourdain
docker-compose golang homework interviewing postgresql rdbms
Last synced: 5 months ago
JSON representation
take-home exercise for stephen
- Host: GitHub
- URL: https://github.com/janearc/bourdain
- Owner: janearc
- Created: 2024-10-07T19:32:37.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-15T21:41:53.000Z (over 1 year ago)
- Last Synced: 2025-04-09T11:11:09.659Z (about 1 year ago)
- Topics: docker-compose, golang, homework, interviewing, postgresql, rdbms
- Language: Go
- Homepage:
- Size: 120 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bourdain
take-home exercise for stephen
# problem
given a set of restaurants with attributes:
```json
{
"restaurants": [
{
"name": "string",
"capacity": {
"two-top": 1, // integer
"four-top": 2, // integer,
"six-top": 3, // integer
},
"endorsements": [
"gluten-free",
"kid-friendly",
"paleo"
],
"location": [
37.7749,
-122.4194
]
}
]
}
```
and a set of diners with attributes:
```json
{
"diners": [
{
"name": "string",
"location": [
37.7749,
-122.4194
],
"preferences": [
"gluten-free",
"kid-friendly",
"paleo"
]
}
]
}
```
create two endpoints:
```golang
// restaurantAvailability returns a list of restaurants that can accommodate the number of diners at the given time
http.HandleFunc("/restaurant/available", func(w http.ResponseWriter, r *http.Request) {
// reservations are assumed to be two hours
startTime := r.URL.Query().Get("startTime")
// how you implement this is up to you
diners := r.URL.Query().Get("diners")
})
```
```golang
// restaurantBook reserves the correct number of tables at the given restaurant
http.HandleFunc("/restaurant/book", func(w http.ResponseWriter, r *http.Request) {
// reservations are assumed to be two hours
startTime := r.URL.Query().Get("startTime")
// how you implement this is up to you
diners := r.URL.Query().Get("diners")
// how you implement this is up to you
restaurant := r.URL.Query().Get("restaurant")
})
```
Only API is in scope; UI is out of scope. You may use a database. The solution does not need to be publicly deployed
but should be developed in a manner consistent with production code. Language is your choice but please do not use
befunge.
Solution is in this directory in SOLUTION.md