Implements all 88 tasks for the Reaction Image Board (specs/001-reaction-image-board): - docker-compose.yml: postgres, minio, minio-init, api, ui services with healthchecks - api/: FastAPI app with SQLAlchemy 2.x async, Alembic migrations, S3/MinIO storage, full integration + unit test suite (pytest + pytest-asyncio) - ui/: Angular 19 standalone app (Library, Upload, Detail, NotFound components) - .env.example: all required environment variables - .gitignore: Python, Node, Docker, IDE, .env patterns Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
35 lines
878 B
Python
35 lines
878 B
Python
from typing import AsyncGenerator
|
|
|
|
from fastapi import Depends
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from app.auth.noop import NoOpAuthProvider
|
|
from app.auth.provider import AuthProvider
|
|
from app.database import get_session_factory
|
|
from app.storage.backend import StorageBackend
|
|
from app.storage.s3_backend import S3StorageBackend
|
|
|
|
_storage: StorageBackend | None = None
|
|
_auth: AuthProvider | None = None
|
|
|
|
|
|
def get_storage() -> StorageBackend:
|
|
global _storage
|
|
if _storage is None:
|
|
_storage = S3StorageBackend()
|
|
return _storage
|
|
|
|
|
|
def get_auth() -> AuthProvider:
|
|
global _auth
|
|
if _auth is None:
|
|
_auth = NoOpAuthProvider()
|
|
return _auth
|
|
|
|
|
|
async def get_db() -> AsyncGenerator[AsyncSession, None]:
|
|
factory = get_session_factory()
|
|
async with factory() as session:
|
|
async with session.begin():
|
|
yield session
|