summaryrefslogtreecommitdiff
path: root/shopdb/_status.py
blob: 40110480f5038b8a87d43d158105a2bee8f31c9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
__all__ = ["Status"]


import enum
from sqlalchemy import Column, Integer, String, DateTime, Enum
from sqlalchemy.orm import relationship
from sqlalchemy import ForeignKey
from ._base import Base, engine


class StatusValues(enum.Enum):
    unstarted = 1
    proceeding = 2
    completed = 3
    deferred = 4
    waiting = 5
    canceled = 6


class Status(Base):
     __tablename__ = 'event'
     id = Column(Integer, primary_key=True)
     comment = Column(String)
     value = Column(Enum(StatusValues))
     timestamp = Column(DateTime)
     job_id = Column(Integer, ForeignKey("jobs.id"))
     job = relationship("Job", back_populates="status_updates")

     def __repr__(self):
        return "<Status(value='%s')>" % (self.value)