import Models
from app import db


class LastReadMessageModel(Models.Base):
    __tablename__ = 'last_read_message'

    user_id = db.Column(db.ForeignKey('user.id'), primary_key=True)
    user = db.relationship(
        "UserModel",
        foreign_keys=user_id
    )
    channel_id = db.Column(db.ForeignKey('channel.id'), primary_key=True)
    channel = db.relationship(
        "ChannelModel",
        foreign_keys=channel_id
    )
    post_id = db.Column(db.ForeignKey('post.id'), nullable=True)
    post = db.relationship(
        "PostModel",
        foreign_keys=post_id
    )
