import sys from sqlalchemy_utils import UUIDType, EmailType, LocaleType, TimezoneType from sqlalchemy.dialects.postgresql import JSONB from pytz import timezone as pytz_timezone from babel import Locale from zou.app import db from zou.app.models.serializer import SerializerMixin from zou.app.models.base import BaseMixin from zou.app import config department_link = db.Table( "department_link", db.Column("person_id", UUIDType(binary=False), db.ForeignKey("person.id")), db.Column("department_id", UUIDType(binary=False), db.ForeignKey("department.id")), ) class Person(db.Model, BaseMixin, SerializerMixin): """ Describe a member of the studio (and an API user). """ first_name = db.Column(db.String(80), nullable=False) last_name = db.Column(db.String(80), nullable=False) email = db.Column(EmailType, unique=True) phone = db.Column(db.String(30)) active = db.Column(db.Boolean(), default=True)
from sqlalchemy_utils import UUIDType from sqlalchemy.dialects.postgresql import JSONB from zou.app import db from zou.app.models.serializer import SerializerMixin from zou.app.models.base import BaseMixin preview_link_table = db.Table( "comment_preview_link", db.Column( "comment", UUIDType(binary=False), db.ForeignKey("comment.id"), primary_key=True, ), db.Column( "preview_file", UUIDType(binary=False), db.ForeignKey("preview_file.id"), primary_key=True, ), ) mentions_table = db.Table( "comment_mentions", db.Column( "comment", UUIDType(binary=False), db.ForeignKey("comment.id"), primary_key=True, ),
from sqlalchemy_utils import UUIDType from sqlalchemy.dialects.postgresql import JSONB from zou.app import db from zou.app.models.serializer import SerializerMixin from zou.app.models.base import BaseMixin assignees_table = db.Table( "assignations", db.Column( "task", UUIDType(binary=False), db.ForeignKey("task.id"), primary_key=True, ), db.Column( "person", UUIDType(binary=False), db.ForeignKey("person.id"), primary_key=True, ), ) class Task(db.Model, BaseMixin, SerializerMixin): """ Describes a task done by a CG artist on an entity of the CG production. The task has a state and assigned to people. It handles notion of time like duration, start date and end date. """ name = db.Column(db.String(80), nullable=False)
from sqlalchemy_utils import UUIDType from zou.app import db from zou.app.models.serializer import SerializerMixin from zou.app.models.base import BaseMixin association_table = db.Table( 'assignations', db.Column('task', UUIDType(binary=False), db.ForeignKey('task.id')), db.Column('person', UUIDType(binary=False), db.ForeignKey('person.id'))) class Task(db.Model, BaseMixin, SerializerMixin): name = db.Column(db.String(80), nullable=False) description = db.Column(db.String(200)) duration = db.Column(db.Integer) estimation = db.Column(db.Integer) completion_rate = db.Column(db.Integer) sort_order = db.Column(db.Integer) start_date = db.Column(db.DateTime) end_date = db.Column(db.DateTime) due_date = db.Column(db.DateTime) real_start_date = db.Column(db.DateTime) shotgun_id = db.Column(db.Integer) project_id = \ db.Column(UUIDType(binary=False), db.ForeignKey('project.id')) task_type_id = \ db.Column(UUIDType(binary=False), db.ForeignKey('task_type.id')) task_status_id = \ db.Column(UUIDType(binary=False), db.ForeignKey('task_status.id'))
from zou.app import db from zou.app.models.serializer import OutputFileSerializer from zou.app.models.base import BaseMixin from sqlalchemy.dialects.postgresql import JSONB dependent_table = db.Table( "dependent_link", db.Column( "output_file_id", UUIDType(binary=False), db.ForeignKey("output_file.id"), nullable=False ), db.Column( "dependent_file_id", UUIDType(binary=False), db.ForeignKey("dependent_file.id"), primary_key=True, ) ) class OutputFile(db.Model, BaseMixin, OutputFileSerializer): """ Describe a file generated from a CG artist scene. It's the result of a publication. It is linked to a working/ children/ dependent file, an entity and a task type. """
from zou.app import db from zou.app.models.serializer import SerializerMixin from zou.app.models.base import BaseMixin from zou.app.utils import fields from sqlalchemy.dialects.postgresql import JSONB entity_link = db.Table( 'entity_link', db.Column( 'entity_in_id', UUIDType(binary=False), db.ForeignKey('entity.id') ), db.Column( 'entity_out_id', UUIDType(binary=False), db.ForeignKey('entity.id') ) ) class Entity(db.Model, BaseMixin, SerializerMixin): id = db.Column( UUIDType(binary=False), primary_key=True, default=fields.gen_uuid )
from sqlalchemy_utils import UUIDType from zou.app import db from zou.app.models.serializer import SerializerMixin from zou.app.models.base import BaseMixin task_type_link = db.Table( "task_type_asset_type_link", db.Column( "asset_type_id", UUIDType(binary=False), db.ForeignKey("entity_type.id"), ), db.Column( "task_type_id", UUIDType(binary=False), db.ForeignKey("task_type.id"), ), ) class EntityType(db.Model, BaseMixin, SerializerMixin): """ Type of entities. It can describe either an asset type, or tell if target entity is a shot, sequence, episode or layout scene. """ name = db.Column(db.String(30), unique=True, nullable=False, index=True) task_types = db.relationship("TaskType", secondary=task_type_link, lazy="joined")
from sqlalchemy_utils import UUIDType from zou.app import db from zou.app.models.serializer import SerializerMixin from zou.app.models.base import BaseMixin assignees_table = db.Table( 'assignations', db.Column( 'task', UUIDType(binary=False), db.ForeignKey('task.id'), primary_key=True ), db.Column( 'person', UUIDType(binary=False), db.ForeignKey('person.id'), primary_key=True ) ) class Task(db.Model, BaseMixin, SerializerMixin): """ Describes a task done by a CG artist on an entity of the CG production. The task has a state and assigned to people. It handles notion of time like duration, start date and end date. """ name = db.Column(db.String(80), nullable=False) description = db.Column(db.String(200))
from sqlalchemy_utils import UUIDType from sqlalchemy.dialects.postgresql import JSONB from zou.app import db from zou.app.models.serializer import SerializerMixin from zou.app.models.base import BaseMixin department_metadata_descriptor_link = db.Table( "department_metadata_descriptor_link", db.Column( "metadata_descriptor_id", UUIDType(binary=False), db.ForeignKey("metadata_descriptor.id"), ), db.Column( "department_id", UUIDType(binary=False), db.ForeignKey("department.id") ), ) class MetadataDescriptor(db.Model, BaseMixin, SerializerMixin): """ This models allow to identify which metadata are available for a given project and a given entity type. """ project_id = db.Column( UUIDType(binary=False), db.ForeignKey("project.id"), nullable=False, index=True,