22 lines
630 B
Python
22 lines
630 B
Python
from fastapi import APIRouter, Depends
|
|
from sqlalchemy import select
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from app.core.deps import get_db
|
|
from app.models.app_nav_config import AppNavConfig
|
|
from app.schemas.app_nav_config import AppNavConfigOut
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/nav", response_model=list[AppNavConfigOut])
|
|
async def list_nav_config(
|
|
db: AsyncSession = Depends(get_db),
|
|
):
|
|
result = await db.execute(
|
|
select(AppNavConfig)
|
|
.where(AppNavConfig.is_active.is_(True))
|
|
.order_by(AppNavConfig.sort_order.asc(), AppNavConfig.id.asc())
|
|
)
|
|
return result.scalars().all()
|