pazka / LokimoTestDjango

Quick project for Lokimo job offer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lokimo API Test

Why

Made to answer the Lokimo Job Offer,

Usage

  • 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 its 4789

  • 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.

Search

Commune

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

Radius

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

Average Summary

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

Tests :

Link to postman for API testing :

Run in Postman

About

Quick project for Lokimo job offer


Languages

Language:Python 96.1%Language:Dockerfile 3.9%