Skip to content

Bugfix/refactoring - #18

Open
Zloydoom4ik wants to merge 9 commits into
sputnik-llc:mainfrom
Zloydoom4ik:bugfix/refactoring
Open

Bugfix/refactoring#18
Zloydoom4ik wants to merge 9 commits into
sputnik-llc:mainfrom
Zloydoom4ik:bugfix/refactoring

Conversation

@Zloydoom4ik

@Zloydoom4ik Zloydoom4ik commented Jul 21, 2026

Copy link
Copy Markdown

Task 1 — backend refactoring (layered architecture)
Split the monolithic service.py into layers:
core/config — validated configuration; core/database — single DB engine and get_session.
repositories — database access; services — business logic (FileService, AlertService, StorageService, ProcessingService); exceptions — domain exceptions.
api — routers plus deps plus translation of exceptions into HTTP statuses; app.py became a create_app() factory.
Celery tasks moved onto the shared engine and the service layer.
Removed: the second DB engine, DSN duplication, dead code, duplicated download logic, mkdir side effect on import. Business logic preserved.

Task 2 — non-obvious optimization
File upload switched to streaming to disk (shutil.copyfileobj) instead of reading the whole file into memory, so RAM usage stays constant regardless of file size.

Additional
Fixed the frontend build (the Dockerfile copied a missing .env.production); the API address was moved out of the hardcode into NEXT_PUBLIC_API_URL.

Task 3 (splitting the frontend into layers) was not done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant