- bash (optional for automated scripts)
- Docker (optional and highly recommended)
- Python 3
- Pip
- Django
- PostgreSQL
- psycopg2-binary
- haversine
- drf-yasg (Swagger not deprecatted)
More info here
-
Cd to repo main folder
-
Execute:
python -m venv venv
-
Then check "venv" folder must be in repo main folder
-
Add envs in activate script inside venv folder. List of envs are in list.env (change DB values). Example as PS: $env:<var>=value
[PRECONDITION] Must set up all of envs listed at "list.env" in your system env variables (change DB values)
-
Cd to repo main folder
-
Cd to sucursal_crud (top-level)
-
Create admin user
python manage.py createsuperuser
Then complete inputs...
-
Run Unit Test
python manage.py test
-
Run API
Cd to repo root folder
Execute script "runAPI.sh"
-
Use API
Browse to "http://localhost:8000"
(If port 8000 is not free)
Open script runAPI.sh
Change it and save script
(If only updates models objects or do not have folder migrations in sucursal_crud_api)
Cd to sucursal_crud (top-level)
python manage.py makemigrations sucursal_crud_api
-
If you have venv installed and folder initialized inside challenge-api folder, script executes with venv. Otherwise wonder if you want to execute without venv.
-
Upgrade pip and install dependencies
-
Create database entities
-
Start server command
-
Cd to repo main folder
-
Execute bash script "runDocker.sh"
-
Create admin user (containers must be running)
docker-compose exec web python manage.py createsuperuser
-
Run Unit Test (containers must be running)
docker-compose exec web python manage.py test
-
Execute any command inside containers
docker-compose exec web <command>
(If you need another container config, edit docker-compose.yml file)
-
Build image of API
-
Execute docker compose and start containers with configuration at docker-compose.yml
Frontend of django for administrate api and database objects
Must have admin user for use it
If server is running, you could visit root endpoint API for Swagger DOCs
Documents all following endpoints and model objects
-
GET
Gets all sucursal objects (no pagination)
-
POST
Creates new sucursal
Request Data:
OK Example:
Error Example:
-
GET
Gets sucursal with requested id
OK example:
Error example:
-
DELETE
Deletes sucursal with requested id (logic deleted not contemplated)
OK example:
Error example:
-
PUT
Updates sucursal with requested id and data provided
Request Data:
OK Example:
Error Example:
Error id not exist:
-
GET
Gets all puntoDeRetiro objects (no pagination)
-
POST
Creates new puntoDeRetiro
Request Data:
OK Example:
Error Example:
-
GET
Gets puntoDeRetiro with requested id
OK example:
Error example:
-
DELETE
Deletes puntoDeRetiro with requested id (logic deleted not contemplated)
OK example:
Error example:
-
PUT
Updates puntoDeRetiro with requested id and data provided
Request Data:
OK Example:
Error Example:
Error id not exist: