api impl
This commit is contained in:
21
db/models/Markdown.py
Normal file
21
db/models/Markdown.py
Normal file
@@ -0,0 +1,21 @@
|
||||
#db/models/Markdown.py
|
||||
from sqlalchemy import Column, Text, Integer, String, DateTime
|
||||
from db.models import Base
|
||||
import datetime
|
||||
|
||||
class Markdown(Base):
|
||||
__tablename__ = 'markdown'
|
||||
id = Column(Integer, primary_key=True)
|
||||
title = Column(String(255), nullable=False)
|
||||
content = Column(Text, nullable=False)
|
||||
created_at = Column(DateTime, default=datetime.datetime.utcnow)
|
||||
path = Column(String(255), nullable=False)
|
||||
|
||||
def to_dict(self):
|
||||
return {
|
||||
'id': self.id,
|
||||
'title': self.title,
|
||||
'content': self.content,
|
||||
'created_at': self.created_at,
|
||||
'path': self.path,
|
||||
}
|
||||
Reference in New Issue
Block a user