[UPD] Added api to create Library
This commit is contained in:
@@ -10,8 +10,8 @@ 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))
|
||||
name: Mapped[str] = mapped_column(String(255), unique=True)
|
||||
notes: Mapped[Optional[str]] = mapped_column(String(65656))
|
||||
|
||||
envs: Mapped[List["Env"]] = relationship(
|
||||
back_populates="library", cascade="all, delete-orphan"
|
||||
@@ -29,5 +29,12 @@ class Library(Base):
|
||||
back_populates="library", cascade="all, delete-orphan"
|
||||
)
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
return {
|
||||
"id": self.id,
|
||||
"name": self.name,
|
||||
"notes": self.notes
|
||||
}
|
||||
|
||||
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