manage markdowns by path

This commit is contained in:
h z
2024-12-05 18:28:16 +00:00
parent 178219f097
commit 4b9c1ba727
4 changed files with 116 additions and 6 deletions

17
db/models/Path.py Normal file
View File

@@ -0,0 +1,17 @@
#db/models/Path.py
from sqlalchemy import Column, Text, LargeBinary, String, Integer, ForeignKey, UniqueConstraint
from db.models import Base
class Path(Base):
__tablename__ = "path"
id = Column(Integer, primary_key=True, autoincrement=True)
name = Column(String(50), nullable=False)
parent_id = Column(Integer, ForeignKey("path.id"))
__table_args__ = (UniqueConstraint("parent_id", "name", name="unique_parent_id_name"), )
def to_dict(self):
return {
"id": self.id,
"name": self.name,
"parent_id": self.parent_id,
}