code format

This commit is contained in:
Jakub Miazek
2024-04-24 10:37:08 +02:00
parent 43fe665608
commit c2975fd260
19 changed files with 358 additions and 173 deletions

View File

@@ -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]