19 lines
611 B
Python
19 lines
611 B
Python
from sqlalchemy import Column, Text, Integer, String, UniqueConstraint,JSON
|
|
from db.models import Base
|
|
|
|
class MarkdownTemplate(Base):
|
|
__tablename__ = 'markdown_template'
|
|
id = Column(Integer, primary_key=True)
|
|
title = Column(String(255), nullable=False)
|
|
parameters = Column(JSON, nullable=True)
|
|
layout = Column(Text, nullable=True)
|
|
__table_args__ = (UniqueConstraint("title", name="unique_title"),)
|
|
|
|
def to_dict(self):
|
|
return {
|
|
'id': self.id,
|
|
'title': self.title,
|
|
'parameters': self.parameters,
|
|
'layout': self.layout,
|
|
}
|