Parking System API to manage car parking in parks. Handles fee calculation and provides endpoint to make payment.
Clone the repo
clone with ssh, use
git clone git@github.com:malikwahab/parking-system.git
# clone with https, use
git clone https://github.com/malikwahab/parking-system.git
After cloning, create a virtual environment and install the requirements. For Linux and Mac users:
$ cd parking-system
$ virtualenv -p python3.6 venv
$ source venv/bin/activate
$ pip install -r requirements.txt
If you are on Windows, then use the following commands instead:
$ virtualenv -p python3 venv
$ venv\Scripts\activate
(venv) $ pip install -r requirements.txt
python manage.py migrate
python manage.py runserver
To run the tests for the app, and see the coverage, run
python manage.py test
This Application uses browsable API. To get started visit the home url
Get a swagger documentation of the API
GET /schema
POST /park
{
"name": "string",
"maximum_no_cars": 0,
"tenants": [
"string"
]
}
GET /park
GET /park/{id}
PUT /park/{id}
{
"name": "string",
"maximum_no_cars": 0,
"tenants": [
"string"
]
}
DELETE /park/{id}
Retrive the fee paid and the outstanding ticket fees
This endpoint accept a query param days
that specify the number of days back to get payment for, if not specified, the all time payment details will be returned
GET /park/{park_id}/payment-details?days=1
GET /park/{park_pk}/parkingtickets/
POST /park/{park_pk}/parkingtickets/
{
"plate_number": "string",
"park": "string",
"tenant": "string"
}
GET /park/{park_pk}/parkingtickets/{id}/
PUT /park/{park_pk}/parkingtickets/{id}/
{
"plate_number": "string",
"park": "string",
"tenant": "string"
}
DELETE /park/{park_pk}/parkingtickets/{id}/
POST /pay-ticket/{ticket_id}/
{
"fee_paid": 0
}
Successful if all payment has been made, fail otherwise
GET /exit/{ticket_id}/
POST /park/{park_pk}/tenants/
{
"name": "string",
"parks": [
"string"
]
}
GET /park/{park_pk}/tenants/
GET /park/{park_pk}/tenants/{id}
PUT /park/{park_pk}/tenants/{id}/
DELETE /park/{park_pk}/tenants/{id}/