This repo is a starter project for engineering manager candidates. It runs Postgres 13 in docker, has a database schema with two tables and seed data for both.
You need Docker to run this project. Please run docker-compose up -d
to download the image and start the container, it will create the database, the tables and will add the seed data.
We added a Makefile to the project for easier interaction. Run make help
to see what commands are available for you.
In case the make
tool is not available on your operating system, open up the Makefile and copy/paste the commands from there.
An easy way to look into the content of the database is by running docker-compose exec db psql -U $(POSTGRES_USER) -d $(POSTGRES_DB)
(or executing the corresponding make command, make docker.db-prompt
), that will provide the psql
prompt, the command-line tool of PostgreSQL.
We would like to assess your skills in the following areas:
- Docker
- Git
- GitHub
- A programming language - current SpotHero Languages (Python, Kotlin, Swift, GoLang)
- SQL
- REST
- APIs
We ask you to create an API project on top of this provided database schema. You can use any language, any framework you're confident with.
The application has to expose two GET
endpoints and one POST
.
GET
all active users
curl http://localhost:3000/v1/users
should return a JSON like this (we only captured the first record, your solution should return 10 records):
[
{
"id": 1,
"first_name": "Radchelle",
"last_name": "Haggerty",
"email": "[email protected]"
},
...
]
GET
all worked_hours for users
The following curl request curl http://localhost:3000/v1/users/1/worked_hours
should return 6 records in a format like this:
[
{
"id": 1,
"date": "2021-01-01",
"hours": "3.9"
},
{
"id": 1,
"date": "2021-01-04",
"hours": "4.134"
},
...
]
POST
a new worked_hour record
By using the following curl request:
curl --header "Content-Type: application/json" \
--request POST \
--data '{"date": "2021-01-11","hours":5.24}' \
http://localhost:3000/v1/users/1/worked_hours
a new worked_hour
record is inserted into the database.
Although it's not required, if you have time, we would love to see:
- Automated tests for your solution,
- A Dockerfile to run the API project in Docker, maybe expanding our docker-compose.yml with it.