[REF] Refactor
This commit is contained in:
29
app/schema/library/library.py
Normal file
29
app/schema/library/library.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from typing import List
|
||||
from typing import Optional
|
||||
from sqlalchemy import String
|
||||
from sqlalchemy.orm import Mapped
|
||||
from sqlalchemy.orm import mapped_column
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from .base import Base
|
||||
|
||||
class Library(Base):
|
||||
__tablename__ = "library"
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
name: Mapped[str] = mapped_column(String(255))
|
||||
notes: Mapped[str] = mapped_column(String(65656))
|
||||
|
||||
envs: Mapped[List["Env"]] = relationship(
|
||||
back_populates="library", cascade="all, delete-orphan"
|
||||
)
|
||||
|
||||
paths: Mapped[List["Path"]] = relationship(
|
||||
back_populates="library", cascade="all, delete-orphan"
|
||||
)
|
||||
|
||||
books: Mapped[List["Book"]] = relationship(
|
||||
back_populates="library", cascade="all, delete-orphan"
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"Library(id={self.id!r}, name={self.name!r}, notes={self.notes!r}"
|
||||
Reference in New Issue
Block a user