diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2021-03-06 15:17:10 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2021-03-06 15:17:10 +0100 |
| commit | 2c170793e9d7e1c61910c908b97eaf1f3cb4de11 (patch) | |
| tree | 07852cc88dfb2270aa8c065fdbca34977a8fb4cd /animism-align/cli/app/sql/models | |
| parent | 2167b0d496544f2ce904cd0036fdb8dd809ff7a0 (diff) | |
add project type
Diffstat (limited to 'animism-align/cli/app/sql/models')
| -rw-r--r-- | animism-align/cli/app/sql/models/annotation.py | 4 | ||||
| -rw-r--r-- | animism-align/cli/app/sql/models/episode.py | 2 | ||||
| -rw-r--r-- | animism-align/cli/app/sql/models/media.py | 2 | ||||
| -rw-r--r-- | animism-align/cli/app/sql/models/project.py | 32 | ||||
| -rw-r--r-- | animism-align/cli/app/sql/models/venue.py | 2 |
5 files changed, 41 insertions, 1 deletions
diff --git a/animism-align/cli/app/sql/models/annotation.py b/animism-align/cli/app/sql/models/annotation.py index 7363d16..750267a 100644 --- a/animism-align/cli/app/sql/models/annotation.py +++ b/animism-align/cli/app/sql/models/annotation.py @@ -13,6 +13,7 @@ class Annotation(Base): """Table for storing references to annotations""" __tablename__ = 'annotation' id = Column(Integer, primary_key=True) + episode_id = Column(Integer) type = Column(String(16, convert_unicode=True), nullable=False) paragraph_id = Column(Integer, nullable=True) start_ts = Column(Float, nullable=False) @@ -23,8 +24,9 @@ class Annotation(Base): def toJSON(self): return { 'id': self.id, - 'type': self.type, + 'episode_id': self.episode_id, 'paragraph_id': self.paragraph_id, + 'type': self.type, 'start_ts': self.start_ts, 'end_ts': self.end_ts, 'text': self.text, diff --git a/animism-align/cli/app/sql/models/episode.py b/animism-align/cli/app/sql/models/episode.py index 60c94ed..916c5dc 100644 --- a/animism-align/cli/app/sql/models/episode.py +++ b/animism-align/cli/app/sql/models/episode.py @@ -16,6 +16,7 @@ class Episode(Base): title = Column(String(256, convert_unicode=True), nullable=False) release_date = Column(String(256, convert_unicode=True)) is_live = Column(Boolean, default=False) + show_venues = Column(Boolean, default=False) settings = Column(JSON, default={}, nullable=True) def toJSON(self): @@ -25,6 +26,7 @@ class Episode(Base): 'title': self.title, 'release_date': self.release_date, 'is_live': self.is_live, + 'show_venues': self.show_venues, 'settings': self.settings, } diff --git a/animism-align/cli/app/sql/models/media.py b/animism-align/cli/app/sql/models/media.py index 4628f4d..ae16255 100644 --- a/animism-align/cli/app/sql/models/media.py +++ b/animism-align/cli/app/sql/models/media.py @@ -12,6 +12,7 @@ class Media(Base): """Table for storing references to media""" __tablename__ = 'media' id = Column(Integer, primary_key=True) + episode_id = Column(Integer) type = Column(String(16, convert_unicode=True), nullable=False) tag = Column(String(64, convert_unicode=True), nullable=True) url = Column(String(256, convert_unicode=True), nullable=True) @@ -30,6 +31,7 @@ class Media(Base): def toJSON(self): return { 'id': self.id, + 'episode_id': self.episode_id, 'type': self.type, 'tag': self.tag, 'url': self.url, 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() diff --git a/animism-align/cli/app/sql/models/venue.py b/animism-align/cli/app/sql/models/venue.py index 74a928c..e9d3015 100644 --- a/animism-align/cli/app/sql/models/venue.py +++ b/animism-align/cli/app/sql/models/venue.py @@ -12,6 +12,7 @@ class Venue(Base): """Table for storing the venue list""" __tablename__ = 'venue' id = Column(Integer, primary_key=True) + project_id = Column(Integer) title = Column(String(256, convert_unicode=True), nullable=False) date = Column(String(256, convert_unicode=True), nullable=False) settings = Column(JSON, default={}, nullable=True) @@ -19,6 +20,7 @@ class Venue(Base): def toJSON(self): return { 'id': self.id, + 'project_id': self.project_id, 'title': self.title, 'date': self.date, 'settings': self.settings, |
