Initial commit: VoIdeaAI - voice-first AI idea assistant
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
"""Public tariff API routes for VoIdea."""
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.core.dependencies import get_db
|
||||
from app.schemas.tariff import TariffPlanResponse
|
||||
from app.services.tariff_service import TariffService
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("", response_model=list[TariffPlanResponse])
|
||||
async def list_tariffs(db: AsyncSession = Depends(get_db)):
|
||||
"""Return all active tariff plans (public, no auth required)."""
|
||||
service = TariffService(db)
|
||||
plans = await service.list_plans(active_only=True)
|
||||
return [
|
||||
TariffPlanResponse(
|
||||
id=str(p.id),
|
||||
name=p.name,
|
||||
code=p.code,
|
||||
description=p.description,
|
||||
price_monthly=p.price_monthly,
|
||||
price_yearly=p.price_yearly,
|
||||
features=p.features,
|
||||
is_active=p.is_active,
|
||||
sort_order=p.sort_order,
|
||||
created_at=p.created_at,
|
||||
updated_at=p.updated_at,
|
||||
)
|
||||
for p in plans
|
||||
]
|
||||
Reference in New Issue
Block a user