Files
gogo-telefon/gogo/main.py
Senad Uka e855650f09 M1: backend core + proposal engine
- FastAPI skeleton, SQLAlchemy models (§13), Alembic initial migration
- SchedulingProvider interface with google_calendar (free/busy read-only),
  partner_api (Appendix B client) and mock implementations
- Proposal engine: create → provider-routed delivery → owner actions
  (resolve/confirm+SMS/reject) → expiry + reminders (§9)
- Signed single-use action links, .ics METHOD:REQUEST attachment
- Partner outcome webhook with HMAC verification + polling fallback
- SmsProvider (console) with Bosnian templates (§5.5), EmailProvider (console/SMTP)
- Fake partner API server in tests/ — Appendix B reference implementation
- 43 tests: slot math, proposal lifecycle, action links, partner contract

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 09:45:06 +02:00

40 lines
916 B
Python

"""FastAPI application assembly."""
from __future__ import annotations
import logging
from contextlib import asynccontextmanager
from fastapi import FastAPI
from gogo.api import actions, health, webhooks
from gogo.config import get_settings
logging.basicConfig(
level=logging.INFO, format="%(asctime)s %(levelname)s %(name)s %(message)s"
)
@asynccontextmanager
async def lifespan(app: FastAPI):
scheduler = None
if get_settings().env != "test":
from gogo.jobs import build_scheduler
scheduler = build_scheduler()
scheduler.start()
yield
if scheduler:
scheduler.shutdown(wait=False)
def create_app() -> FastAPI:
app = FastAPI(title="Gogo Telefon", docs_url=None, redoc_url=None, lifespan=lifespan)
app.include_router(health.router)
app.include_router(actions.router)
app.include_router(webhooks.router)
return app
app = create_app()