refactoring-backend #3

Merged
lukas.pupkalipinski merged 403 commits from refactoring-backend into main 2026-05-20 20:23:46 +02:00
2 changed files with 1 additions and 38 deletions
Showing only changes of commit ac53a56ae7 - Show all commits

View File

@@ -1,40 +1,3 @@
## [Backend] `get_password_hash` lives in `setup_service` but is used by `auth_service`
**Where found**
- `backend/app/services/auth_service.py:27` — imports `get_password_hash` from `setup_service`
**Why this is needed**
`auth_service.py` handles all authentication concerns and is the natural home for password hash retrieval. Having it import from `setup_service` creates incorrect semantic dependency and unnecessary coupling.
**Goal**
Move `get_password_hash` to `auth_service.py` where it belongs, or to a shared `app/utils/crypto.py` module.
**What to do**
1. Move the `get_password_hash` function body from `app/services/setup_service.py` to `app/services/auth_service.py`
2. Update the import in `auth_service.py` to use the local function
3. Search all of `backend/app/` for usages and update imports
4. Remove the function from `setup_service.py`
**Possible traps and issues**
- Search thoroughly for all usages before removing — may be imported in tests, other services, setup router
- If used during initial setup flow, update that usage to import from `auth_service` instead
**Docs changes needed**
- No documentation changes required — internal code reorganization
**Doc references**
- `backend/app/services/auth_service.py`
- `backend/app/services/setup_service.py`
---
## [Backend] `re` module imported inside function body
**Where found**

View File

@@ -12,6 +12,7 @@ on ``app.state`` throughout the request lifecycle.
from __future__ import annotations
import logging
import re
import sys
from contextlib import asynccontextmanager
from typing import TYPE_CHECKING
@@ -196,7 +197,6 @@ def _get_error_code(exc: Exception) -> str:
return exc.error_code
exc_name = exc.__class__.__name__
import re
snake_case = re.sub(r"(?<!^)(?=[A-Z])", "_", exc_name).lower()
return snake_case