Birds watching is mock application that can CReate, Update and Delete Birds and Sightings entities. Birds can be sighted multiple times in different location and different times.
Create the docker image
docker build ./ -t birds-watching
Run the project
docker compose -f ./docker-compose.yml up -d
Using Postman, import the birds-watching.postman_collection.json
and you can play with the API.
A bird entity has a name
, a color
, a weight
and a height
. Also, a bird has a list of sightings as a relation(one-to-many).
{
"name": "Canary",
"color": "yellow",
"weight": 8,
"height": 10,
"sightings": []
}
A sigting entity has a location
and a timestamp
. They have a many-to-one relation with a bird entity
{
"location": "Bucegi",
"timestamp":"2024-08-11T21:18:05.418296",
"bird": <Bird>
}
GET /birds
retuns a list of all birds.GET /birds?name=${NAME}
returns a list of birds based on the name.GET /birds?color=${COLOR}
returns a list of birds based on their colorGET /birds?name=${NAME}&${COLOR}
returns a list of birds based on their name and colorPOST /birds
creates a bird with the provided payloadPATCH /birds/${ID}
updates a bird if the id provided is validDELETE /birds/${ID}
deletes a bird if the id provided is valid
GET /sightings/${birdId}
returns a list of sightings of a specific birdPOST /sightings/location
returns a list of sightings in a specific locationPOST /sightings/interval
returns a list of sightings within a specific intervalPOST /sightings/bird/${birdId}
creates a sighting of a specific birdPATCH /sightings/bird/${birdId}/${sightingId}
updates a sighting of a specific birdDELETE /sightings/${id}
deletes a specific sighting