made fastapi tools
This commit is contained in:
+1
-1
@@ -9,9 +9,9 @@ import typer
|
|||||||
import uvicorn
|
import uvicorn
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
|
|
||||||
from python.api.middleware import ZstdMiddleware
|
|
||||||
from python.api.routers import contact_router, views_router
|
from python.api.routers import contact_router, views_router
|
||||||
from python.common import configure_logger
|
from python.common import configure_logger
|
||||||
|
from python.fastapi_tools import ZstdMiddleware
|
||||||
from python.orm.common import get_postgres_engine
|
from python.orm.common import get_postgres_engine
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from pydantic import BaseModel
|
|||||||
from sqlalchemy import select
|
from sqlalchemy import select
|
||||||
from sqlalchemy.orm import selectinload
|
from sqlalchemy.orm import selectinload
|
||||||
|
|
||||||
from python.api.dependencies import DbSession
|
from python.fastapi_tools.db import DbSession
|
||||||
from python.orm.richie.contact import Contact, ContactRelationship, Need, RelationshipType
|
from python.orm.richie.contact import Contact, ContactRelationship, Need, RelationshipType
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent / "templates"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from fastapi.templating import Jinja2Templates
|
|||||||
from sqlalchemy import select
|
from sqlalchemy import select
|
||||||
from sqlalchemy.orm import Session, selectinload
|
from sqlalchemy.orm import Session, selectinload
|
||||||
|
|
||||||
from python.api.dependencies import DbSession
|
from python.fastapi_tools.db import DbSession
|
||||||
from python.orm.richie.contact import Contact, ContactRelationship, Need, RelationshipType
|
from python.orm.richie.contact import Contact, ContactRelationship, Need, RelationshipType
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent / "templates"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates"
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
"""Reusable FastAPI tools."""
|
||||||
|
|
||||||
|
from python.fastapi_tools.db import DbSession, get_db
|
||||||
|
from python.fastapi_tools.zstd_middleware import ZstdMiddleware
|
||||||
|
|
||||||
|
__all__ = ["DbSession", "ZstdMiddleware", "get_db"]
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
"""Middleware for the FastAPI application."""
|
"""Zstd response compression middleware."""
|
||||||
|
|
||||||
from compression import zstd
|
from compression import zstd
|
||||||
from starlette.middleware.base import BaseHTTPMiddleware, RequestResponseEndpoint
|
from starlette.middleware.base import BaseHTTPMiddleware, RequestResponseEndpoint
|
||||||
Reference in New Issue
Block a user