This commit is contained in:
Joan
2026-02-23 15:42:21 +01:00
parent a725ae5836
commit d38d4cc288
102 changed files with 4511 additions and 4454 deletions

View File

@@ -10,6 +10,8 @@ from ..services.helpers import get_game_message
from ..core.security import create_access_token, hash_password, verify_password, get_current_user
from ..services.models import UserRegister, UserLogin
from .. import database as db
from ..items import items_manager
from ..services.helpers import calculate_player_capacity, enrich_character_data
router = APIRouter(prefix="/api/auth", tags=["authentication"])
@@ -110,23 +112,7 @@ async def login(user: UserLogin):
"is_premium": account.get("premium_expires_at") is not None,
},
"characters": [
{
"id": char["id"],
"name": char["name"],
"level": char["level"],
"xp": char["xp"],
"hp": char["hp"],
"max_hp": char["max_hp"],
"stamina": char["stamina"],
"max_stamina": char["max_stamina"],
"strength": char["strength"],
"agility": char["agility"],
"endurance": char["endurance"],
"intellect": char["intellect"],
"avatar_data": char.get("avatar_data"),
"last_played_at": char.get("last_played_at"),
"location_id": char["location_id"],
}
await enrich_character_data(char, items_manager)
for char in characters
],
"needs_character_creation": len(characters) == 0
@@ -188,17 +174,7 @@ async def get_account(current_user: Dict[str, Any] = Depends(get_current_user)):
"last_login_at": account.get("last_login_at"),
},
"characters": [
{
"id": char["id"],
"name": char["name"],
"level": char["level"],
"xp": char["xp"],
"hp": char["hp"],
"max_hp": char["max_hp"],
"location_id": char["location_id"],
"avatar_data": char.get("avatar_data"),
"last_played_at": char.get("last_played_at"),
}
await enrich_character_data(char, items_manager)
for char in characters
]
}
@@ -373,17 +349,7 @@ async def steam_login(steam_data: Dict[str, Any]):
"last_login_at": account.get("last_login_at")
},
"characters": [
{
"id": char["id"],
"name": char["name"],
"level": char["level"],
"xp": char["xp"],
"hp": char["hp"],
"max_hp": char["max_hp"],
"location_id": char["location_id"],
"avatar_data": char.get("avatar_data"),
"last_played_at": char.get("last_played_at")
}
await enrich_character_data(char, items_manager)
for char in characters
],
"needs_character_creation": len(characters) == 0