From 2c170793e9d7e1c61910c908b97eaf1f3cb4de11 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 6 Mar 2021 15:17:10 +0100 Subject: add project type --- animism-align/cli/app/sql/models/project.py | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 animism-align/cli/app/sql/models/project.py (limited to 'animism-align/cli/app/sql/models/project.py') diff --git a/animism-align/cli/app/sql/models/project.py b/animism-align/cli/app/sql/models/project.py new file mode 100644 index 0000000..eb94fd6 --- /dev/null +++ b/animism-align/cli/app/sql/models/project.py @@ -0,0 +1,32 @@ +from sqlalchemy import create_engine, Table, Column, Text, String, Integer, Boolean, Float, DateTime, JSON, ForeignKey +from sqlalchemy.orm import relationship +import sqlalchemy.sql.functions as func +from sqlalchemy_utc import UtcDateTime, utcnow +from wtforms_alchemy import ModelForm + +from app.sql.common import db, Base, Session + +from app.settings import app_cfg + +class Project(Base): + """Table for storing projects and their metadata""" + __tablename__ = 'project' + id = Column(Integer, primary_key=True) + title = Column(String(256, convert_unicode=True), nullable=False) + is_live = Column(Boolean, default=False) + settings = Column(JSON, default={}, nullable=True) + + def toJSON(self): + return { + 'id': self.id, + 'title': self.title, + 'is_live': self.is_live, + 'settings': self.settings, + } + +class ProjectForm(ModelForm): + class Meta: + model = Episode + exclude = ['settings'] + def get_session(): + return Session() -- cgit v1.2.3-70-g09d2