Made to answer the Lokimo Job Offer,
-
To run the app, you'll need to have docker installed and run the command
docker compose up
-
The result should be an API exposed to request on the port defined in the
.env
file, for this readme its4789
-
To feed the DB, use
docker exec -it lokimo_app python manage.py importdata
-
API exposed at : http://127.0.0.1:4789/swagger/ , only on debug configuration. As you'll see, I created the endpoints by respecting REST guidelines.
Using any tool you want :
127.0.0.1:4789/ad/search?city=44009,44047
will return ads in the city 44009 or 44047
127.0.0.1:4789/ad/search?city=44009
will return ads in the city 44009
But due to django capabilities, it works with any first order property of the model.
Thus 127.0.0.1:4789/ad/search?city=44009,44047&iris=440090101
works as well
The search by radius is just another criteria in the 'ad/search' API :
127.0.0.1:4789/ad/search?x=47.2155884&y=-1.4653951&r=500
Will works and you can compose this parameters with the previous ones
The average report re-uses the search mecanism but changes the report :
127.0.0.1:4789/ad/summary?x=47.2155884&y=-1.4653951&r=500
works as well as
127.0.0.1:4789/ad/summary?city=44009,44047&iris=440090101
Link to postman for API testing :