- Separate booking_status, payment_arrangement, and payment_status in schema.sql and booking endpoints.
- Add GET /bookings/follow-up-queue, POST /bookings/{id}/authorize-delayed-payment, POST /bookings/{id}/release, and POST /payments/acknowledge.
- Add CalendarService adapter tracking gcal_sync_status with manual retry endpoint (POST /bookings/{id}/sync-calendar).
- Add integration test suite covering OAuth allowlist, 48h follow-up queue, delayed-payment exceptions, and slot release.
Refs: #3
55 lines
1.3 KiB
Python
55 lines
1.3 KiB
Python
from __future__ import annotations
|
|
|
|
import contextlib
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from app.core.config import settings
|
|
from app.db.init_db import init_schema_and_seed
|
|
from app.routers import auth, bookings, health, packages, payments, services
|
|
|
|
|
|
@contextlib.asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
# Ensure tables, bootstrap allowlist, and initial catalog are seeded on boot
|
|
await init_schema_and_seed()
|
|
yield
|
|
|
|
|
|
app = FastAPI(
|
|
title="Armonía del Ser API",
|
|
description=(
|
|
"Operational source-of-truth backend sitting between Google Calendar, Turso, "
|
|
"and the Admin Dashboard protected with Google OAuth + Turso allowlisting."
|
|
),
|
|
version="0.2.0",
|
|
lifespan=lifespan,
|
|
)
|
|
|
|
# CORS configuration
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=settings.cors_origins,
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Include Routers
|
|
app.include_router(health.router)
|
|
app.include_router(auth.router)
|
|
app.include_router(services.router)
|
|
app.include_router(bookings.router)
|
|
app.include_router(packages.router)
|
|
app.include_router(payments.router)
|
|
|
|
|
|
@app.get("/")
|
|
def root():
|
|
return {
|
|
"service": settings.business_name,
|
|
"tagline": "Cada día, un espacio para volver a ti",
|
|
"docs_url": "/docs",
|
|
}
|