The Postigen is a simple parcel movement application API. The front-end solution you can find here. It allows:
- the user to create a parcel order with a sender and receiver;
- put the parcels in the locker;
- move the parcels between lockers;
- take out the parcel from the locker.
The project has an active admin panel which is accessible via admin/
.
All CRUD operations can be performed there.
- [GET/POST]
/api/parcels/
- list all parcels or create a parcel - [GET/DELETE]
/api/parcel/:id/
- get or delete single parcel by its ID - [PUT]
/api/parcels/:id/put-parcel/
- put parcel in specific locker referencing by its ID - [PUT]
/api/parcels/:id/move-parcel/
- move parcel from one locker to another referencing by their IDs
- [GET/POST]
/api/lockers/
- list all lockers or create one - [GET/DELTE]
/api/lockers/:id/
- get or delete single locker by its ID - [PUT]
/api/lockers/:id/take-parcel/
- take out the parcel from the locker by referencing their ID as a parameter and body data
- [GET/POST]
/api/customers/
- list all customers or create one - [GET/DELETE]
api/customers/:id/
- get or delete single customer by its ID
- The project is based on the
Python v3.11
,Django v4.2.5
withDjango Rest Framework (DRF) v3.14.0
. - For the data storage the project utilises
Postgres v15.4
. - Postigen is dockerized, therefore, please ensure to have installed
Docker
on your machine. - Tests are based on Pytest library.
-
Ensure that you have the latest Docker binaries installed on your computer.
-
Create and fill the
.local.env
configuration file with the appropriate values. Set up the database values as needed. -
Run docker-compose to build the image and containers. Database will be created automatically.
docker-compose up
-
See the containers running in Docker. Get the container's ID of the brainiac app, copy it.
docker ps
-
Activate the bash terminal of the container
docker exec -it <container_id> bash
-
Migrate migrations files.
python manage.py migrate
-
Create a superuser for the CMS admin panel.
python manage.py createsuperuser
-
The project comes with the fixture file which holds pre-made data for quicker testing which can be applied.
python manage.py loaddata fixtures/initial_data.json
Even if you decide to install the project using the Docker
way, it is advised to steps 3 and 4 from this section
for Django to recognize packages and their import across IDE.
-
Define the development environment in the terminal.
export DJANGO_DEVELOPMENT=true
-
Create and fill the
.local.env
configuration file with the proper values. -
Create and activate a virtual environment (command for MacOS/Linux). The current project's Python version is
3.11
.python3.11 -m venv venv source venv/bin/activate
-
Install requirements.
pip install -r requirements.txt
-
Migrate migrations files.
python manage.py migrate
-
Create a superuser for the CMS admin panel.
python manage.py createsuperuser
-
Run Django server.
python manage.py runserver
All unit tests are launched from the container's bash.
-
Run docker-compose to build the image and containers. Database will be created automatically.
docker-compose up
-
See the containers running in Docker. Get the container's ID of the brainiac app, copy it.
docker ps
-
Activate the bash terminal of the container.
docker exec -it <container_id> bash
-
Launch tests.
python manage.py test -v 2
The project holds pre-made Postman collection file that can be imported for the quicker testing.
-
Each new branch should be created from the
main
branch. -
For the branch naming, start each branch name with the prefix according to the work you intend to do in it:
- feature/
- bugfix/
-
For the merge request, target the working branch to the
master
branch.