mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2026-01-17 11:40:39 +03:00
Merge branch 'switch-logger-to-rotoger' of https://github.com/grillazz/fastapi-sqlalchemy-asyncpg into switch-logger-to-rotoger
This commit is contained in:
@@ -12,8 +12,6 @@ logger = get_logger()
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
|
||||
|
||||
@router.get("/redis", status_code=status.HTTP_200_OK)
|
||||
async def redis_check(request: Request):
|
||||
"""
|
||||
|
||||
@@ -47,7 +47,7 @@ async def lifespan(app: FastAPI):
|
||||
def create_app() -> FastAPI:
|
||||
app = FastAPI(
|
||||
title="Stuff And Nonsense API",
|
||||
version="0.20.0",
|
||||
version="1.22.0",
|
||||
lifespan=lifespan,
|
||||
)
|
||||
app.include_router(stuff_router)
|
||||
|
||||
@@ -46,10 +46,10 @@ class Character(Base):
|
||||
abbrev: Mapped[str | None] = mapped_column(String(32))
|
||||
description: Mapped[str | None] = mapped_column(String(2056))
|
||||
|
||||
work: Mapped[list["Work"]] = relationship(
|
||||
work: Mapped[list[Work]] = relationship(
|
||||
"Work", secondary="shakespeare.character_work", back_populates="character"
|
||||
)
|
||||
paragraph: Mapped[list["Paragraph"]] = relationship(
|
||||
paragraph: Mapped[list[Paragraph]] = relationship(
|
||||
"Paragraph", back_populates="character"
|
||||
)
|
||||
|
||||
@@ -122,11 +122,11 @@ class Work(Base):
|
||||
total_paragraphs: Mapped[int] = mapped_column(Integer)
|
||||
notes: Mapped[str | None] = mapped_column(Text)
|
||||
|
||||
character: Mapped[list["Character"]] = relationship(
|
||||
character: Mapped[list[Character]] = relationship(
|
||||
"Character", secondary="shakespeare.character_work", back_populates="work"
|
||||
)
|
||||
chapter: Mapped[list["Chapter"]] = relationship("Chapter", back_populates="work")
|
||||
paragraph: Mapped[list["Paragraph"]] = relationship(
|
||||
chapter: Mapped[list[Chapter]] = relationship("Chapter", back_populates="work")
|
||||
paragraph: Mapped[list[Paragraph]] = relationship(
|
||||
"Paragraph", back_populates="work"
|
||||
)
|
||||
|
||||
@@ -170,8 +170,8 @@ class Chapter(Base):
|
||||
chapter_number: Mapped[int] = mapped_column(Integer)
|
||||
description: Mapped[str] = mapped_column(String(256))
|
||||
|
||||
work: Mapped["Work"] = relationship("Work", back_populates="chapter")
|
||||
paragraph: Mapped[list["Paragraph"]] = relationship(
|
||||
work: Mapped[Work] = relationship("Work", back_populates="chapter")
|
||||
paragraph: Mapped[list[Paragraph]] = relationship(
|
||||
"Paragraph", back_populates="chapter"
|
||||
)
|
||||
|
||||
@@ -259,11 +259,9 @@ class Paragraph(Base):
|
||||
char_count: Mapped[int] = mapped_column(Integer)
|
||||
word_count: Mapped[int] = mapped_column(Integer)
|
||||
|
||||
character: Mapped["Character"] = relationship(
|
||||
"Character", back_populates="paragraph"
|
||||
)
|
||||
chapter: Mapped["Chapter"] = relationship("Chapter", back_populates="paragraph")
|
||||
work: Mapped["Work"] = relationship("Work", back_populates="paragraph")
|
||||
character: Mapped[Character] = relationship("Character", back_populates="paragraph")
|
||||
chapter: Mapped[Chapter] = relationship("Chapter", back_populates="paragraph")
|
||||
work: Mapped[Work] = relationship("Work", back_populates="paragraph")
|
||||
|
||||
@classmethod
|
||||
async def find(cls, db_session: AsyncSession, character: str):
|
||||
|
||||
@@ -29,7 +29,7 @@ class Stuff(Base):
|
||||
name: Mapped[str] = mapped_column(String, primary_key=True, unique=True)
|
||||
description: Mapped[str | None]
|
||||
|
||||
nonsense: Mapped["Nonsense"] = relationship(
|
||||
nonsense: Mapped[Nonsense] = relationship(
|
||||
"Nonsense", secondary="happy_hog.stuff_full_of_nonsense"
|
||||
)
|
||||
|
||||
@@ -47,7 +47,7 @@ class StuffFullOfNonsense(Base):
|
||||
UUID(as_uuid=True), default=uuid.uuid4, primary_key=True
|
||||
)
|
||||
stuff_id: Mapped[Stuff] = mapped_column(UUID, ForeignKey("happy_hog.stuff.id"))
|
||||
nonsense_id: Mapped["Nonsense"] = mapped_column(
|
||||
nonsense_id: Mapped[Nonsense] = mapped_column(
|
||||
UUID, ForeignKey("happy_hog.nonsense.id")
|
||||
)
|
||||
but_why: Mapped[str | None]
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
Reference in New Issue
Block a user