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