Exemplo n.º 1
0
class StatusAutomation(db.Model, BaseMixin, SerializerMixin):
    """
    Status automations are entries that allow to describe changes that
    should automatically apply after a task status is changed.

    For instance, a Modeling task set to done will imply to set the Rigging
    task status to ready and the *ready_for* field to be set at Layout.
    """

    entity_type = db.Column(db.String(40), default="asset")

    in_task_type_id = db.Column(UUIDType(binary=False),
                                db.ForeignKey("task_type.id"),
                                index=True)
    in_task_status_id = db.Column(UUIDType(binary=False),
                                  db.ForeignKey("task_status.id"),
                                  index=True)

    out_field_type = db.Column(ChoiceType(CHANGE_TYPES), default="status")
    out_task_type_id = db.Column(UUIDType(binary=False),
                                 db.ForeignKey("task_type.id"),
                                 index=True)
    out_task_status_id = db.Column(
        UUIDType(binary=False),
        db.ForeignKey("task_status.id"),
        index=True,
        nullable=True,
    )
Exemplo n.º 2
0
class Milestone(db.Model, BaseMixin, SerializerMixin):
    """
    Allow to set a milestone date to the production schedule.
    """

    date = db.Column(db.Date())
    name = db.Column(db.String(40), nullable=False)

    project_id = db.Column(
        UUIDType(binary=False), db.ForeignKey("project.id"), index=True
    )
    task_type_id = db.Column(
        UUIDType(binary=False), db.ForeignKey("task_type.id"), index=True
    )

    def present(self):
        return fields.serialize_dict(
            {
                "id": self.id,
                "date": self.date,
                "name": self.name,
                "project_id": self.project_id,
                "task_type_id": self.task_type_id,
            }
        )
Exemplo n.º 3
0
class ScheduleItem(db.Model, BaseMixin, SerializerMixin):
    """
    Allow to set a start date and an end date for a task type and a project.
    This information allows to build a schedule for the project.
    """
    start_date = db.Column(db.Date())
    end_date = db.Column(db.Date())
    man_days = db.Column(db.Integer)

    project_id = db.Column(UUIDType(binary=False),
                           db.ForeignKey('project.id'),
                           index=True)
    task_type_id = db.Column(UUIDType(binary=False),
                             db.ForeignKey('task_type.id'),
                             index=True)
    entity_id = db.Column(UUIDType(binary=False),
                          db.ForeignKey('task_type.id'),
                          index=True)  # Sequence or Episode

    def present(self):
        return fields.serialize_dict({
            "id": self.id,
            "start_date": self.start_date,
            "end_date": self.end_date,
            "man_days": self.man_days,
            "project_id": self.project_id,
            "task_type_id": self.task_type_id
        })
Exemplo n.º 4
0
class Comment(db.Model, BaseMixin, SerializerMixin):
    """
    Comment can occurs on any object but they are mainly used on tasks.
    In the case of comment tasks, they are linked to a task status and
    eventually on a preview file.
    The status means that comment leads to task status change. The preview file
    means that the comment relates to this preview in the context of the task.
    """
    shotgun_id = db.Column(db.Integer)

    object_id = db.Column(UUIDType(binary=False), nullable=False, index=True)
    object_type = db.Column(db.String(80), nullable=False, index=True)
    text = db.Column(db.Text())
    data = db.Column(JSONB)
    checklist = db.Column(JSONB)
    pinned = db.Column(db.Boolean)

    task_status_id = db.Column(UUIDType(binary=False),
                               db.ForeignKey("task_status.id"))
    person_id = db.Column(UUIDType(binary=False),
                          db.ForeignKey("person.id"),
                          nullable=False)
    preview_file_id = db.Column(UUIDType(binary=False),
                                db.ForeignKey("preview_file.id"))
    previews = db.relationship("PreviewFile",
                               secondary=preview_link_table,
                               backref="comments")
    mentions = db.relationship("Person", secondary=mentions_table)

    def __repr__(self):
        return "<Comment of %s>" % self.object_id
Exemplo n.º 5
0
class DependentFile(db.Model, BaseMixin, SerializerMixin):
    """
    Describe a file generated from a CG artist scene. 
    It aims to know the dependencies of an outputfile.
    """
    __tablename__ = "dependent_file"
    source_output_file_id = db.Column(
        UUIDType(binary=False), db.ForeignKey("output_file.id"), nullable=True
    )
    size = db.Column(db.Integer())
    checksum = db.Column(db.String(32))
    extension = db.Column(db.String(10))
    path = db.Column(db.String(400), unique=True)
    used_by = relationship(
        "OutputFile", secondary=dependent_table, back_populates="dependent_files"
    )
    project_id = db.Column(
        UUIDType(binary=False), db.ForeignKey("project.id")
    )
    temporal_entity_id = db.Column(
        UUIDType(binary=False),
        db.ForeignKey("entity.id"),
        default=None,
        nullable=True,
    )

    def __repr__(self):
        return "<DependentFile %s>" % self.id
Exemplo n.º 6
0
class Subscription(db.Model, BaseMixin, SerializerMixin):
    """
    Allow to subscribe to an entity
    """

    person_id = db.Column(
        UUIDType(binary=False),
        db.ForeignKey("person.id"),
        nullable=False,
        index=True,
    )
    task_id = db.Column(
        UUIDType(binary=False), db.ForeignKey("task.id"), index=True
    )

    entity_id = db.Column(
        UUIDType(binary=False), db.ForeignKey("entity.id"), index=True
    )
    task_type_id = db.Column(
        UUIDType(binary=False), db.ForeignKey("task_type.id"), index=True
    )

    __table_args__ = (
        db.UniqueConstraint(
            "person_id", "task_id", name="subscription_task_uc"
        ),
        db.UniqueConstraint(
            "person_id",
            "task_type_id",
            "entity_id",
            name="subscription_entity_uc",
        ),
    )
Exemplo n.º 7
0
class PreviewFile(db.Model, BaseMixin, SerializerMixin):
    """
    Describes a file which is aimed at being reviewed. It is not a publication
    neither a working file.
    """
    name = db.Column(db.String(250))
    revision = db.Column(db.Integer(), default=1)
    description = db.Column(db.Text())
    path = db.Column(db.String(400))

    source = db.Column(db.String(40))
    shotgun_id = db.Column(db.Integer, unique=True)

    is_movie = db.Column(db.Boolean, default=False)

    url = db.Column(db.String(600))
    uploaded_movie_url = db.Column(db.String(600))
    uploaded_movie_name = db.Column(db.String(150))

    task_id = db.Column(UUIDType(binary=False),
                        db.ForeignKey("task.id"),
                        index=True)
    person_id = db.Column(UUIDType(binary=False), db.ForeignKey("person.id"))

    source_file_id = db.Column(UUIDType(binary=False),
                               db.ForeignKey("output_file.id"))

    __table_args__ = (db.UniqueConstraint("name",
                                          "task_id",
                                          "revision",
                                          name="preview_uc"), )

    def __repr__(self):
        return "<PreviewFile %s>" % self.id
Exemplo n.º 8
0
class WorkingFile(db.Model, BaseMixin, SerializerMixin):
    shotgun_id = db.Column(db.Integer())

    name = db.Column(db.String(250))
    description = db.Column(db.String(200))
    comment = db.Column(db.Text())
    revision = db.Column(db.Integer())
    size = db.Column(db.Integer())
    checksum = db.Column(db.Integer())

    task_id = db.Column(UUIDType(binary=False), db.ForeignKey("task.id"))
    entity_id = db.Column(UUIDType(binary=False), db.ForeignKey("entity.id"))
    person_id = \
        db.Column(UUIDType(binary=False), db.ForeignKey("person.id"))

    __table_args__ = (
        db.UniqueConstraint(
            "name",
            "task_id",
            "entity_id",
            "revision",
            name="working_file_uc"
        ),
    )

    def __repr__(self):
        return "<WorkingFile %s>" % self.id
Exemplo n.º 9
0
class Playlist(db.Model, BaseMixin, SerializerMixin):
    """
    Describes a playlist. The goal is to review a set of shipped materials.
    """

    name = db.Column(db.String(80), nullable=False)
    shots = db.Column(JSONB)

    project_id = db.Column(UUIDType(binary=False),
                           db.ForeignKey("project.id"),
                           index=True)
    episode_id = db.Column(UUIDType(binary=False),
                           db.ForeignKey("entity.id"),
                           index=True)
    for_client = db.Column(db.Boolean(), default=False, index=True)
    for_entity = db.Column(db.String(10), default="shot", index=True)
    is_for_all = db.Column(db.Boolean, default=False)

    build_jobs = relationship("BuildJob")

    __table_args__ = (db.UniqueConstraint("name",
                                          "project_id",
                                          "episode_id",
                                          name="playlist_uc"), )

    @classmethod
    def create_from_import(cls, data):
        del data["type"]
        del data["build_jobs"]
        previous_data = cls.get(data["id"])
        if previous_data is None:
            return cls.create(**data)
        else:
            previous_data.update(data)
            return previous_data
Exemplo n.º 10
0
class AssetInstance(db.Model, BaseMixin, SerializerMixin):
    """
    An asset instance is the representation of an asset in a given shot or
    layout scene. It is useful for complex scenes where an asset needs extra
    treatments only related to the given shot or layout scene.
    An asset can have multiple instances in a scene (ex: a sword in a battle
    field).
    """
    asset_id = db.Column(UUIDType(binary=False),
                         db.ForeignKey('entity.id'),
                         nullable=False)
    entity_id = db.Column(UUIDType(binary=False),
                          db.ForeignKey('entity.id'),
                          nullable=False)
    entity_type_id = db.Column(UUIDType(binary=False),
                               db.ForeignKey('entity_type.id'),
                               nullable=False)
    number = db.Column(db.Integer())
    description = db.Column(db.String(200))
    data = db.Column(JSONB)

    __table_args__ = (db.UniqueConstraint('asset_id',
                                          'entity_id',
                                          'number',
                                          name='asset_instance_uc'), )

    def __repr__(self):
        return "<AssetInstance %s>" % self.id
Exemplo n.º 11
0
class Entity(db.Model, BaseMixin, SerializerMixin):
    id = db.Column(
        UUIDType(binary=False),
        primary_key=True,
        default=fields.gen_uuid
    )

    name = db.Column(db.String(160), nullable=False)
    description = db.Column(db.String(300))
    shotgun_id = db.Column(db.Integer)

    project_id = db.Column(
        UUIDType(binary=False), db.ForeignKey('project.id'), nullable=False)
    entity_type_id = db.Column(
        UUIDType(binary=False), db.ForeignKey('entity_type.id'), nullable=False)
    parent_id = db.Column(
        UUIDType(binary=False), db.ForeignKey('entity.id'))
    data = db.Column(JSONB)

    entities_out = db.relationship(
        'Entity',
        secondary=entity_link,
        primaryjoin=(id == entity_link.c.entity_in_id),
        secondaryjoin=(id == entity_link.c.entity_out_id)
    )

    __table_args__ = (
        db.UniqueConstraint(
            'name',
            'project_id',
            'entity_type_id',
            'parent_id',
            name='entity_uc'
        ),
    )
Exemplo n.º 12
0
class EntityLink(db.Model, BaseMixin, SerializerMixin):
    __tablename__ = "entity_link"
    entity_in_id = db.Column(
        UUIDType(binary=False), db.ForeignKey("entity.id"), primary_key=True,
        index=True
    )
    entity_out_id = db.Column(
        UUIDType(binary=False), db.ForeignKey("entity.id"), primary_key=True,
        index=True
    )
    nb_occurences = db.Column(db.Integer, default=1)
    label = db.Column(db.String(80), default="")

    @classmethod
    def create_from_import(cls, data):
        del data["type"]
        if "project_name" in data:
            del data["project_name"]
        entity_link = cls.get_by(
            entity_in_id=data["entity_in_id"],
            entity_out_id=data["entity_out_id"],
        )
        if entity_link is None:
            return cls.create(**data)
        else:
            entity_link.update(data)
            return entity_link
Exemplo n.º 13
0
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))

    priority = db.Column(db.Integer, default=0)
    duration = db.Column(db.Integer, default=0)
    estimation = db.Column(db.Integer, default=0)
    completion_rate = db.Column(db.Integer, default=0)
    sort_order = db.Column(db.Integer, default=0)
    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'),
        index=True
    )
    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')
    )
    entity_id = db.Column(
        UUIDType(binary=False),
        db.ForeignKey('entity.id'),
        index=True
    )
    assigner_id = db.Column(
        UUIDType(binary=False),
        db.ForeignKey('person.id')
    )

    assignees = db.relationship(
        'Person',
        secondary=association_table
    )

    __table_args__ = (
        db.UniqueConstraint(
            'name',
            'project_id',
            'task_type_id',
            'entity_id',
            name='task_uc'
        ),
    )

    def assignees_as_string(self):
        return ", ".join([x.full_name() for x in self.assignees])
Exemplo n.º 14
0
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'))
    entity_id = \
        db.Column(UUIDType(binary=False), db.ForeignKey('entity.id'))
    assigner_id = \
        db.Column(UUIDType(binary=False), db.ForeignKey('person.id'))

    assignees = db.relationship('Person', secondary=association_table)

    def assignees_as_string(self):
        return ", ".join([x.full_name() for x in self.assignees])
Exemplo n.º 15
0
class WorkingFile(db.Model, BaseMixin, SerializerMixin):
    """
    Describes the file related to the work done on a given task. It is
    used as source of output files published for a given entity.
    """
    shotgun_id = db.Column(db.Integer(), index=True)

    name = db.Column(db.String(250))
    description = db.Column(db.String(200))
    comment = db.Column(db.Text())
    revision = db.Column(db.Integer())
    size = db.Column(db.Integer())
    checksum = db.Column(db.Integer())
    path = db.Column(db.String(400))

    task_id = db.Column(UUIDType(binary=False),
                        db.ForeignKey("task.id"),
                        index=True)
    entity_id = db.Column(UUIDType(binary=False),
                          db.ForeignKey("entity.id"),
                          index=True)
    person_id = \
        db.Column(UUIDType(binary=False), db.ForeignKey("person.id"))
    software_id = \
        db.Column(UUIDType(binary=False), db.ForeignKey("software.id"))
    outputs = relationship("OutputFile", back_populates="source_file")

    __table_args__ = (db.UniqueConstraint("name",
                                          "task_id",
                                          "entity_id",
                                          "revision",
                                          name="working_file_uc"), )

    def __repr__(self):
        return "<WorkingFile %s>" % self.id
Exemplo n.º 16
0
class Notification(db.Model, BaseMixin, SerializerMixin):
    """
    A notification is stored each time a comment is posted.
    """
    read = db.Column(db.Boolean, nullable=False, default=False)
    change = db.Column(db.Boolean, nullable=False, default=False)
    person_id = db.Column(UUIDType(binary=False),
                          db.ForeignKey('person.id'),
                          nullable=False,
                          index=True)
    author_id = db.Column(UUIDType(binary=False),
                          db.ForeignKey('person.id'),
                          nullable=False,
                          index=True)
    comment_id = db.Column(UUIDType(binary=False),
                           db.ForeignKey('comment.id'),
                           nullable=False,
                           index=True)
    task_id = db.Column(UUIDType(binary=False),
                        db.ForeignKey('task.id'),
                        nullable=False,
                        index=True)

    __table_args__ = (db.UniqueConstraint('person_id',
                                          'author_id',
                                          'comment_id',
                                          name='notification_uc'), )
Exemplo n.º 17
0
class Entity(db.Model, BaseMixin, SerializerMixin):
    """
    Base model to represent assets, shots, sequences, episodes and scenes.
    They have different meaning but they share the same behaviour toward
    tasks and files.
    """
    id = db.Column(UUIDType(binary=False),
                   primary_key=True,
                   default=fields.gen_uuid)

    name = db.Column(db.String(160), nullable=False)
    code = db.Column(db.String(160))  # To store sanitized version of name
    description = db.Column(db.String(1200))
    shotgun_id = db.Column(db.Integer)
    canceled = db.Column(db.Boolean, default=False)

    nb_frames = db.Column(db.Integer)  # Specific to shots

    project_id = db.Column(UUIDType(binary=False),
                           db.ForeignKey("project.id"),
                           nullable=False,
                           index=True)
    entity_type_id = db.Column(UUIDType(binary=False),
                               db.ForeignKey("entity_type.id"),
                               nullable=False,
                               index=True)

    parent_id = db.Column(UUIDType(binary=False),
                          db.ForeignKey("entity.id"),
                          index=True)  # sequence or episode

    source_id = db.Column(
        UUIDType(binary=False),
        db.ForeignKey("entity.id"),
        index=True,
        nullable=True
    )  # if the entity is generated from another one (like shots from scene).

    preview_file_id = db.Column(
        UUIDType(binary=False),
        db.ForeignKey("preview_file.id", name="fk_main_preview"))
    data = db.Column(JSONB)

    entities_out = db.relationship(
        "Entity",
        secondary="entity_link",
        primaryjoin=(id == EntityLink.entity_in_id),
        secondaryjoin=(id == EntityLink.entity_out_id),
        backref="entities_in")

    instance_casting = db.relationship("AssetInstance",
                                       secondary="asset_instance_link",
                                       backref="shots")

    __table_args__ = (db.UniqueConstraint("name",
                                          "project_id",
                                          "entity_type_id",
                                          "parent_id",
                                          name="entity_uc"), )
Exemplo n.º 18
0
class ProjectAssetTypeLink(db.Model):
    __tablename__ = "project_asset_type_link"
    project_id = db.Column(UUIDType(binary=False),
                           db.ForeignKey("project.id"),
                           primary_key=True)
    asset_type_id = db.Column(UUIDType(binary=False),
                              db.ForeignKey("entity_type.id"),
                              primary_key=True)
Exemplo n.º 19
0
class ProjectTaskStatusLink(db.Model):
    __tablename__ = "project_task_status_link"
    project_id = db.Column(UUIDType(binary=False),
                           db.ForeignKey("project.id"),
                           primary_key=True)
    task_status_id = db.Column(UUIDType(binary=False),
                               db.ForeignKey("task_status.id"),
                               primary_key=True)
Exemplo n.º 20
0
class AssetInstanceLink(db.Model):
    __tablename__ = "asset_instance_link"
    entity_id = db.Column(UUIDType(binary=False),
                          db.ForeignKey("entity.id"),
                          primary_key=True)
    asset_instance_id = db.Column(UUIDType(binary=False),
                                  db.ForeignKey("asset_instance.id"),
                                  primary_key=True)
Exemplo n.º 21
0
class ProjectPersonLink(db.Model):
    __tablename__ = "project_person_link"
    project_id = db.Column(
        UUIDType(binary=False), db.ForeignKey("project.id"), primary_key=True
    )
    person_id = db.Column(
        UUIDType(binary=False), db.ForeignKey("person.id"), primary_key=True
    )
    shotgun_id = db.Column(db.Integer)
Exemplo n.º 22
0
class EntityLink(db.Model, BaseMixin):
    __tablename__ = "entity_link"
    entity_in_id = db.Column(UUIDType(binary=False),
                             db.ForeignKey("entity.id"),
                             primary_key=True)
    entity_out_id = db.Column(UUIDType(binary=False),
                              db.ForeignKey("entity.id"),
                              primary_key=True)
    nb_occurences = db.Column(db.Integer, default=1)
Exemplo n.º 23
0
class EntityVersion(db.Model, BaseMixin, SerializerMixin):
    name = db.Column(db.String(160), nullable=False)
    data = db.Column(JSONB)
    entity_id = db.Column(UUIDType(binary=False),
                          db.ForeignKey("entity.id"),
                          index=True)
    person_id = db.Column(UUIDType(binary=False),
                          db.ForeignKey("person.id"),
                          index=True)
Exemplo n.º 24
0
class PreviewFile(db.Model, BaseMixin, SerializerMixin):
    """
    Describes a file which is aimed at being reviewed. It is not a publication
    neither a working file.
    """

    name = db.Column(db.String(250))
    original_name = db.Column(db.String(250))
    revision = db.Column(db.Integer(), default=1)
    position = db.Column(db.Integer(), default=1)
    extension = db.Column(db.String(6))
    description = db.Column(db.Text())
    path = db.Column(db.String(400))
    source = db.Column(db.String(40))
    file_size = db.Column(db.Integer(), default=0)
    status = db.Column(ChoiceType(STATUSES), default="processing")
    validation_status = db.Column(
        ChoiceType(VALIDATION_STATUSES), default="neutral"
    )
    annotations = db.Column(JSONB)

    task_id = db.Column(
        UUIDType(binary=False), db.ForeignKey("task.id"), index=True
    )
    person_id = db.Column(UUIDType(binary=False), db.ForeignKey("person.id"))
    source_file_id = db.Column(
        UUIDType(binary=False), db.ForeignKey("output_file.id")
    )

    __table_args__ = (
        db.UniqueConstraint("name", "task_id", "revision", name="preview_uc"),
    )

    shotgun_id = db.Column(db.Integer, unique=True)

    is_movie = db.Column(db.Boolean, default=False)  # deprecated
    url = db.Column(db.String(600))  # deprecated
    uploaded_movie_url = db.Column(db.String(600))  # deprecated
    uploaded_movie_name = db.Column(db.String(150))  # deprecated

    def __repr__(self):
        return "<PreviewFile %s>" % self.id

    @classmethod
    def create_from_import(cls, data):
        del data["type"]
        if "comments" in data:
            del data["comments"]
        previous_data = cls.get(data["id"])
        if "status" not in data or data["status"] == None:
            data["status"] = "ready"
        if previous_data is None:
            return (cls.create(**data), False)
        else:
            previous_data.update(data)
            return (previous_data, True)
Exemplo n.º 25
0
class ProjectStatusAutomationLink(db.Model):
    __tablename__ = "project_status_automation_link"
    project_id = db.Column(
        UUIDType(binary=False), db.ForeignKey("project.id"), primary_key=True
    )
    status_automation_id = db.Column(
        UUIDType(binary=False),
        db.ForeignKey("status_automation.id"),
        primary_key=True,
    )
Exemplo n.º 26
0
class AssetInstance(db.Model, BaseMixin, SerializerMixin):
    """
    An asset instance is the representation of an asset in a given shot or
    layout scene. It is useful for complex scenes where an asset needs extra
    treatments only related to the given shot or layout scene.
    An asset can have multiple instances in a scene or in a shot (ex: a sword in
    a battle field).
    """
    asset_id = db.Column(
        UUIDType(binary=False),
        db.ForeignKey('entity.id'),
        nullable=False,
        index=True
    )
    name = db.Column(db.String(80))
    number = db.Column(db.Integer())
    description = db.Column(db.String(200))
    active = db.Column(db.Boolean(), default=True)
    data = db.Column(JSONB)

    scene_id = db.Column(
        UUIDType(binary=False),
        db.ForeignKey('entity.id'),
        index=True
    )

    __table_args__ = (
        db.UniqueConstraint(
            'asset_id',
            'scene_id',
            'number',
            name='asset_instance_uc'
        ),
        db.UniqueConstraint(
            'scene_id',
            'name',
            name='asset_instance_name_uc'
        )
    )

    # Do not use these column. They are deprecated and will be dropped in
    # upcoming version
    entity_id = db.Column(
        UUIDType(binary=False),
        db.ForeignKey('entity.id'),
    )
    entity_type_id = db.Column(
        UUIDType(binary=False),
        db.ForeignKey('entity_type.id')
    )

    def __repr__(self):
        return "<AssetInstance %s>" % self.id
Exemplo n.º 27
0
class SearchFilter(db.Model, BaseMixin, SerializerMixin):
    """
    Filters allow to store quick search on a list: asset list, shot list,
    sequence list, todo-list...
    """
    list_type = db.Column(db.String(80), nullable=False, index=True)
    entity_type = db.Column(db.String(80))
    name = db.Column(db.String(200), nullable=False, default="")
    search_query = db.Column(db.String(200), nullable=False, default="")

    person_id = db.Column(UUIDType(binary=False), db.ForeignKey("person.id"))
    project_id = db.Column(UUIDType(binary=False), db.ForeignKey("project.id"))
Exemplo n.º 28
0
class ProjectTaskTypeLink(db.Model, BaseMixin):
    __tablename__ = "project_task_type_link"
    project_id = db.Column(UUIDType(binary=False),
                           db.ForeignKey("project.id"),
                           primary_key=True)
    task_type_id = db.Column(UUIDType(binary=False),
                             db.ForeignKey("task_type.id"),
                             primary_key=True)
    priority = db.Column(db.Integer, default=None)

    __table_args__ = (db.UniqueConstraint("project_id",
                                          "task_type_id",
                                          name="project_tasktype_uc"), )
Exemplo n.º 29
0
class OutputFile(db.Model, BaseMixin, SerializerMixin):
    """
    Describe a file generated from a CG artist scene. It's the result of a
    publication.
    It is linked to a working file, an entity and a task type.
    """
    shotgun_id = db.Column(db.Integer())

    name = db.Column(db.String(250), nullable=False)
    extension = db.Column(db.String(10))
    revision = db.Column(db.Integer(), nullable=False)
    representation = db.Column(db.String(20), index=True)
    nb_elements = db.Column(db.Integer(), default=1)

    path = db.Column(db.String(400))

    description = db.Column(db.Text())
    comment = db.Column(db.Text())
    size = db.Column(db.Integer())
    checksum = db.Column(db.String(32))
    source = db.Column(db.String(40))

    canceled = db.Column(db.Boolean(), default=False, nullable=False)

    file_status_id = db.Column(UUIDType(binary=False),
                               db.ForeignKey("file_status.id"),
                               nullable=False)
    entity_id = db.Column(UUIDType(binary=False), db.ForeignKey("entity.id"))
    asset_instance_id = db.Column(UUIDType(binary=False),
                                  db.ForeignKey("asset_instance.id"),
                                  index=True)
    output_type_id = db.Column(UUIDType(binary=False),
                               db.ForeignKey("output_type.id"),
                               index=True)
    task_type_id = db.Column(UUIDType(binary=False),
                             db.ForeignKey("task_type.id"),
                             index=True)
    person_id = db.Column(UUIDType(binary=False), db.ForeignKey("person.id"))
    source_file_id = db.Column(
        UUIDType(binary=False),
        db.ForeignKey("working_file.id"),
    )
    source_file = relationship("WorkingFile", back_populates="outputs")
    temporal_entity_id = db.Column(UUIDType(binary=False),
                                   db.ForeignKey("entity.id"),
                                   default=None,
                                   nullable=True)

    __table_args__ = (db.UniqueConstraint("name",
                                          "entity_id",
                                          "asset_instance_id",
                                          "output_type_id",
                                          "task_type_id",
                                          "temporal_entity_id",
                                          "representation",
                                          "revision",
                                          name="output_file_uc"), )

    def __repr__(self):
        return "<OutputFile %s>" % self.id
Exemplo n.º 30
0
class ApiEvent(db.Model, BaseMixin, SerializerMixin):
    """
    Represent notable events occuring on database (asset creation,
    task assignation, etc.).
    """

    name = db.Column(db.String(80), nullable=False, index=True)
    user_id = db.Column(UUIDType(binary=False),
                        db.ForeignKey("person.id"),
                        index=True)
    project_id = db.Column(UUIDType(binary=False),
                           db.ForeignKey("project.id"),
                           index=True)
    data = db.Column(JSONB)