Global refactoring of the project to use poetry and implement tests,

fixing bugs, changing the handling of dto and db models, preparing to
add new functionality
This commit is contained in:
2025-06-24 13:30:35 +03:00
parent 51a6ba75c0
commit 6658d773bf
58 changed files with 2521 additions and 1008 deletions

View File

@@ -1,33 +1,30 @@
services:
db:
image: postgres:15-alpine
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
ports:
- "5432:5432"
container_name: db_library
image: postgres
expose:
- 5432
volumes:
- postgres_data:/var/lib/postgresql/data
- ./data/db:/var/lib/postgresql/data
env_file:
- ./.env
api:
container_name: api_library
build: .
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
command: bash -c "alembic upgrade head && uvicorn library_service.main:app --reload --host 0.0.0.0 --port 8000"
volumes:
- .:/code
ports:
- "8000:8000"
volumes:
- ./src/app/migrations/versions:/code/app/migrations/versions
depends_on:
- db
test:
tests:
container_name: tests
build: .
command: pytest
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
command: bash -c "pytest tests/test_misc.py"
volumes:
- .:/code
depends_on:
- db
volumes:
postgres_data: