add: order paths & mds

This commit is contained in:
h z
2024-12-29 18:53:02 +00:00
parent c10c690149
commit a96e833aa6
5 changed files with 103 additions and 9 deletions

View File

@@ -1,5 +1,6 @@
#db/models/Markdown.py
from sqlalchemy import Column, Text, Integer, String, DateTime, ForeignKey
import uuid
from sqlalchemy import Column, Text, Integer, String, DateTime, ForeignKey, Float, text
from db.models import Base
import datetime
@@ -10,6 +11,7 @@ class Markdown(Base):
content = Column(Text, nullable=False)
created_at = Column(DateTime, default=datetime.datetime.utcnow)
path_id = Column(Integer, ForeignKey('path.id'), nullable=False)
order = Column(String(36), default=lambda: str(uuid.uuid4()))
def to_dict(self):
return {
@@ -18,6 +20,7 @@ class Markdown(Base):
'content': self.content,
'created_at': self.created_at,
'path_id': self.path_id,
'order': self.order,
}
__pay_load__ = {
'dev': [
@@ -26,4 +29,4 @@ class Markdown(Base):
'prod': [
{'id': 1, 'title': 'index', 'content': ' ', 'created_at': datetime.datetime.utcnow, 'path_id': 1},
]
}
}