firebreak/web/app/routers/links.py
ZTatman 36c6231266 Add FastAPI setup with async SQLAlchemy and Grant model
- Add config.py with pydantic-settings for env configuration
- Add database.py with async SQLAlchemy (asyncpg driver)
- Add Grant model with id, token, timestamps, and grant_type
- Use Literal[public, private] for type-safe enum storage
- Add routes/links.py with Pydantic request/response models
- Update pyproject.toml dependencies
2026-04-23 17:20:16 -04:00

30 lines
672 B
Python

from datetime import datetime
from typing import Literal
from fastapi import APIRouter
from pydantic import BaseModel, EmailStr
router = APIRouter(prefix="/links", tags=["links"])
class CreateLinkRequest(BaseModel):
repo_owner: str
repo_name: str
branch: str
expires_at: datetime
link_type: Literal["public", "private"] = "public"
recipient_email: EmailStr | None = None
class CreateLinkResponse(BaseModel):
repo_owner: str
repo_name: str
branch: str
expires_at: datetime
commit_sha: str
share_url: str
@router.post("/", response_model=CreateLinkResponse)
async def create_link(request: CreateLinkRequest):
pass