mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-11-30 13:20:40 +03:00
code format
This commit is contained in:
@@ -13,11 +13,15 @@ from app.models.nonsense import Nonsense
|
||||
class Stuff(Base):
|
||||
__tablename__ = "stuff"
|
||||
__table_args__ = ({"schema": "happy_hog"},)
|
||||
id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), unique=True, default=uuid.uuid4, autoincrement=True)
|
||||
id: Mapped[uuid.UUID] = mapped_column(
|
||||
UUID(as_uuid=True), unique=True, default=uuid.uuid4, autoincrement=True
|
||||
)
|
||||
name: Mapped[str] = mapped_column(String, primary_key=True, unique=True)
|
||||
description: Mapped[str | None]
|
||||
|
||||
nonsense: Mapped["Nonsense"] = relationship("Nonsense", secondary="happy_hog.stuff_full_of_nonsense")
|
||||
nonsense: Mapped["Nonsense"] = relationship(
|
||||
"Nonsense", secondary="happy_hog.stuff_full_of_nonsense"
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def find(cls, db_session: AsyncSession, name: str):
|
||||
@@ -42,7 +46,11 @@ class Stuff(Base):
|
||||
class StuffFullOfNonsense(Base):
|
||||
__tablename__ = "stuff_full_of_nonsense"
|
||||
__table_args__ = ({"schema": "happy_hog"},)
|
||||
id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), default=uuid.uuid4, primary_key=True)
|
||||
id: Mapped[uuid.UUID] = mapped_column(
|
||||
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(UUID, ForeignKey("happy_hog.nonsense.id"))
|
||||
nonsense_id: Mapped["Nonsense"] = mapped_column(
|
||||
UUID, ForeignKey("happy_hog.nonsense.id")
|
||||
)
|
||||
but_why: Mapped[str | None]
|
||||
|
||||
Reference in New Issue
Block a user