You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
783 B

import sqlalchemy as sa
import sqlalchemy_utils as sau
from srht.database import Base
from datetime import datetime
class TicketSeen(Base):
"""Stores the last time a user viewed this ticket. Calculates if comments have been seen."""
__tablename__ = 'ticket_seen'
user_id = sa.Column(sa.Integer,
user = sa.orm.relationship("User")
ticket_id = sa.Column(sa.Integer,
sa.ForeignKey('', ondelete="CASCADE"),
ticket = sa.orm.relationship("Ticket", lazy="joined")
last_view = sa.Column(sa.DateTime,
def update(self):
self.last_view = datetime.utcnow()