Implement FIN-WP-0001-T06 HTTP runway read surface
Add create_runway_router() following the hub-core factory pattern, expose GET /runway/summary and /runway/monthly-burn via create_app, and add finhub serve for local operation.
This commit is contained in:
parent
0f2436b34c
commit
29dbaf1c2d
11 changed files with 270 additions and 4 deletions
5
src/fin_hub/schemas/__init__.py
Normal file
5
src/fin_hub/schemas/__init__.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
"""Pydantic schemas for fin-hub HTTP surfaces."""
|
||||
|
||||
from fin_hub.schemas.runway import MonthlyBurnRead, RunwayAlertRead, RunwaySummaryRead
|
||||
|
||||
__all__ = ["MonthlyBurnRead", "RunwayAlertRead", "RunwaySummaryRead"]
|
||||
40
src/fin_hub/schemas/runway.py
Normal file
40
src/fin_hub/schemas/runway.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
"""Read schemas for runway and monthly burn HTTP surfaces."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class MonthlyBurnRead(BaseModel):
|
||||
period_month: str
|
||||
currency: str
|
||||
total: float
|
||||
entry_count: int
|
||||
|
||||
|
||||
class RunwayProjectionRead(BaseModel):
|
||||
current_balance: float
|
||||
monthly_burn: float
|
||||
months_remaining: float | None = Field(
|
||||
description="Projected runway in months; null when burn is zero and balance is positive.",
|
||||
)
|
||||
months_remaining_label: str
|
||||
alert_threshold_months: float
|
||||
below_threshold: bool
|
||||
currency: str
|
||||
computed_at: str
|
||||
|
||||
|
||||
class RunwayAlertRead(BaseModel):
|
||||
code: str
|
||||
severity: str
|
||||
summary: str
|
||||
detail: dict
|
||||
|
||||
|
||||
class RunwaySummaryRead(BaseModel):
|
||||
runway: RunwayProjectionRead
|
||||
alerts: list[RunwayAlertRead]
|
||||
opening_balance: float | None
|
||||
opening_balance_currency: str
|
||||
ledger_path: str
|
||||
Loading…
Add table
Add a link
Reference in a new issue