mirror of
https://github.com/escalante29/WealthySmart.git
synced 2026-07-17 11:28:47 +02:00
The n8n flows fail invisibly from the app's perspective (review UX-17, the top trust gap). /api/v1/sync-status derives last-received + cadence thresholds for BAC, salary, municipal, pensions and exchange rate from existing data — no n8n integration needed. New Sincronización page shows per-source freshness and a hint to check n8n; the sidebar item gets an amber dot when any source is stale. Verified live against the dev DB (correctly flags its stale BAC data at 43 days). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
21 lines
562 B
Python
21 lines
562 B
Python
from fastapi import APIRouter, Depends
|
|
from sqlmodel import Session
|
|
|
|
from app.auth import get_current_user
|
|
from app.db import get_session
|
|
from app.services.sync_status import compute_sync_status
|
|
|
|
router = APIRouter(prefix="/sync-status", tags=["sync-status"])
|
|
|
|
|
|
@router.get("/")
|
|
def sync_status(
|
|
session: Session = Depends(get_session),
|
|
_user: str = Depends(get_current_user),
|
|
):
|
|
sources = compute_sync_status(session)
|
|
return {
|
|
"sources": sources,
|
|
"warnings": sum(1 for s in sources if s["status"] in ("warning", "never")),
|
|
}
|