mirror of https://github.com/logos-co/open-law.git
19 lines
558 B
Python
19 lines
558 B
Python
from app import db
|
|
from app.models.utils import BaseModel
|
|
|
|
|
|
class CommentVote(BaseModel):
|
|
__tablename__ = "comment_votes"
|
|
|
|
# Foreign keys
|
|
user_id = db.Column(db.Integer, db.ForeignKey("users.id"))
|
|
comment_id = db.Column(db.Integer, db.ForeignKey("comments.id"))
|
|
possitive = db.Column(db.Boolean, default=True)
|
|
|
|
# Relationships
|
|
user = db.relationship("User", viewonly=True)
|
|
comment = db.relationship("Comment", viewonly=True)
|
|
|
|
def __repr__(self):
|
|
return f"<{self.user} to {self.comment} Positive:{self.possitive}>"
|