feat: add connections dashboard with background health checks

- Add /connections page showing all integrations with online/offline status
- Add background health checker that polls Evotor API every 10 minutes
- Add is_online and last_checked_at fields to evotor_connections table
- Replace Evotor navbar link with unified Connections link
- Redirect connect/disconnect flows to /connections
- Add Alembic migration for new columns

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mguschin
2026-03-06 15:26:49 +03:00
parent 9edb77efba
commit 379f781e1e
15 changed files with 510 additions and 19 deletions

View File

@@ -118,22 +118,27 @@ async def evotor_callback(
pass # Store info is optional; token is still saved
# Save or update connection
from datetime import datetime
connection = db.query(EvotorConnection).filter(EvotorConnection.user_id == user.id).first()
if connection:
connection.access_token = access_token
connection.store_id = store_id
connection.store_name = store_name
connection.is_online = True
connection.last_checked_at = datetime.utcnow()
else:
connection = EvotorConnection(
user_id=user.id,
access_token=access_token,
store_id=store_id,
store_name=store_name,
is_online=True,
last_checked_at=datetime.utcnow(),
)
db.add(connection)
db.commit()
return RedirectResponse("/evotor", 303)
return RedirectResponse("/connections", 303)
@router.post("/disconnect")
@@ -150,4 +155,4 @@ async def evotor_disconnect(
db.delete(connection)
db.commit()
return RedirectResponse("/evotor", 303)
return RedirectResponse("/connections", 303)