pip install -r requirements.txt
python api.py
mongod
Accepts the following as paramaters in url to filter during GET request: id, name
{
"data": [
{
"_id": {
"$oid": "5ed53309bba829fc7da7ade8"
},
"capacity": 20,
"name": "Pai Tiffins",
"tables": [
{
"$oid": "5ed53321bba829fc7da7ade9"
},
{
"$oid": "5ed5333dbba829fc7da7adea"
}
]
},
{
"_id": {
"$oid": "5ed5370fbba8290ce3ec96aa"
},
"capacity": 20,
"name": "Chinese Wok",
"tables": []
}
],
"status": "ok"
}
{
"data": [
{
"_id": {
"$oid": "5ed5370fbba8290ce3ec96aa"
},
"capacity": 20,
"name": "Chinese Wok",
"tables": []
}
],
"status": "ok"
}
Checks for name (if existing) and adds an empty list of table ids by default
{
"capacity": 20,
"name": "Chinese Wok"
}
{
"response": "Restaurant added with id 5ed5370fbba8290ce3ec96aa"
}
Accepts the following (or combination of) as paramaters in url to filter during GET request: id, restaurant_id, flexible, booking_ids
{
"data": [
{
"_id": {
"$oid": "5ed53348bba829fc7da7adeb"
},
"bookings": [],
"flexible": false,
"restaurant_id": "5ed53309bba829fc7da7ade8",
"size": 4
},
{
"_id": {
"$oid": "5ed5349abba82902522d5a19"
},
"bookings": [
{
"$oid": "5ed53546bba82906bfc7c4bf"
}
],
"flexible": true,
"restaurant_id": "5ed53309bba829fc7da7ade8",
"size": 1
},
{
"_id": {
"$oid": "5ed53954bba8290ce3ec96ab"
},
"bookings": [],
"flexible": true,
"restaurant_id": "5ed5370fbba8290ce3ec96aa",
"size": 4
}
],
"status": "ok"
}
{
"data": [
{
"_id": {
"$oid": "5ed53954bba8290ce3ec96ab"
},
"bookings": [],
"flexible": true,
"restaurant_id": "5ed5370fbba8290ce3ec96aa",
"size": 4
}
],
"status": "ok"
}
Accepts the following as paramaters in url to filter during GET request: id, restaurant_id, time, date
{
"data": [
{
"_id": {
"$oid": "5ed5343dbba82902522d5a18"
},
"date": {
"$date": 1578268800000
},
"name": "Lakshay Kalbhor",
"restaurant_id": "5ed5226bbba829b3a48675cd",
"size": 2,
"table_ids": [
"5ed53361bba829fc7da7aded"
],
"time_end": {
"$date": 1591045200000
},
"time_start": {
"$date": 1591038000000
}
},
{
"_id": {
"$oid": "5ed53546bba82906bfc7c4bf"
},
"date": {
"$date": 1578268800000
},
"name": "Arnav Kalbhor",
"restaurant_id": "5ed5226bbba829b3a48675cd",
"size": 3,
"table_ids": [
"5ed53321bba829fc7da7ade9",
"5ed5333dbba829fc7da7adea",
"5ed5349abba82902522d5a19"
],
"time_end": {
"$date": 1591045200000
},
"time_start": {
"$date": 1591038000000
}
}
],
"status": "ok"
}
{
"name": "Rahul",
"restaurant_id": "5ed5226bbba829b3a48675cd",
"size" : 2,
"date" : "1/06/2020",
"time" : "7:00pm"
}
{
"response": "Booking added with id 5ed53546bba82906bfc7c4bf"
}
If booking slot isn't available it shall return an error ("No tables found")