22 lines
654 B
Python
22 lines
654 B
Python
#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,
|
|
}
|