1f1ed72494
- Full CRUD for backup jobs - Manual job trigger endpoint with background execution - Schedule creation endpoint - Tests for job creation, update, execution, and 404 cases
16 lines
433 B
Python
16 lines
433 B
Python
from fastapi import FastAPI
|
|
from contextlib import asynccontextmanager
|
|
from app.database import engine, Base
|
|
from app.routers import sources, jobs
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
async with engine.begin() as conn:
|
|
await conn.run_sync(Base.metadata.create_all)
|
|
yield
|
|
|
|
app = FastAPI(title="Backup Tool API", lifespan=lifespan)
|
|
|
|
app.include_router(sources.router)
|
|
app.include_router(jobs.router)
|