v0.1 - макет интерфейса, аутентификация через логин, аккаунт админа, создание партии в 2 этапа, базовые настройки профиля и группы, переключение между группами, статистика
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
"""Справочники: дополнения и фракции (для всех авторизованных)."""
|
||||
from __future__ import annotations
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlmodel import Session
|
||||
|
||||
from app.auth.deps import get_current_user
|
||||
from app.db.session import get_session
|
||||
from app.models import User
|
||||
from app.schemas import api as s
|
||||
from app.services import faction_service
|
||||
|
||||
router = APIRouter(tags=["reference"])
|
||||
|
||||
|
||||
@router.get("/expansions", response_model=list[s.ExpansionRead])
|
||||
def list_expansions(
|
||||
session: Session = Depends(get_session),
|
||||
_user: User = Depends(get_current_user),
|
||||
) -> list[s.ExpansionRead]:
|
||||
return [
|
||||
s.ExpansionRead(id=e.id, code=e.code, name_ru=e.name_ru, is_base=e.is_base) # type: ignore[arg-type]
|
||||
for e in faction_service.list_expansions(session)
|
||||
]
|
||||
|
||||
|
||||
@router.get("/factions", response_model=list[s.FactionRead])
|
||||
def list_factions(
|
||||
session: Session = Depends(get_session),
|
||||
_user: User = Depends(get_current_user),
|
||||
) -> list[s.FactionRead]:
|
||||
return [
|
||||
s.FactionRead(
|
||||
id=f.id, code=f.code, name_ru=f.name_ru, expansion_id=f.expansion_id # type: ignore[arg-type]
|
||||
)
|
||||
for f in faction_service.list_factions(session)
|
||||
]
|
||||
Reference in New Issue
Block a user