feat: stabilize KYC, international assets and multi-currency schema

- Split mother's name in KYC (last/first)
- Added mileage_unit and fuel_type to Assets
- Expanded AssetCost for international VAT and original currency
- Fixed SQLAlchemy IndexError in asset catalog lookup
- Added exchange_rate and ratings tables to models
This commit is contained in:
2026-02-08 23:41:07 +00:00
parent 451900ae1a
commit 24d35fe0c1
34 changed files with 709 additions and 347 deletions

View File

@@ -1,4 +1,5 @@
from typing import Optional
import logging
from fastapi import Depends, HTTPException, status
from fastapi.security import OAuth2PasswordBearer
from sqlalchemy.ext.asyncio import AsyncSession
@@ -8,7 +9,7 @@ from app.db.session import get_db
from app.core.security import decode_token
from app.models.identity import User
# Az OAuth2 séma definiálása, ami a tokent keresi a Headerben
logger = logging.getLogger(__name__)
reusable_oauth2 = OAuth2PasswordBearer(tokenUrl="/api/v1/auth/login")
async def get_current_user(
@@ -17,8 +18,13 @@ async def get_current_user(
) -> User:
"""
Dependency, amely visszaadja az aktuálisan bejelentkezett felhasználót.
Ha a token érvénytelen vagy a felhasználó nem létezik, hibát dob.
Támogatja a 'dev_bypass_active' tokent a fejlesztői teszteléshez.
"""
# FEJLESZTŐI BYPASS
if token == "dev_bypass_active":
result = await db.execute(select(User).where(User.id == 1))
return result.scalar_one()
payload = decode_token(token)
if not payload:
raise HTTPException(
@@ -33,7 +39,6 @@ async def get_current_user(
detail="Token azonosítási hiba."
)
# Felhasználó lekérése az adatbázisból
result = await db.execute(select(User).where(User.id == int(user_id)))
user = result.scalar_one_or_none()
@@ -48,8 +53,5 @@ async def get_current_user(
status_code=status.HTTP_403_FORBIDDEN,
detail="Ez a fiók korábban törlésre került."
)
# Megjegyzés: is_active ellenőrzést szándékosan nem teszünk itt,
# hogy a KYC folyamatot (Step 2) be tudja fejezni a még nem aktív user is.
return user