summaryrefslogtreecommitdiff
path: root/src/database/models/comment.py
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2024-02-05 12:53:45 -0600
committerHombreLaser <sebastian-440@live.com>2024-02-05 12:53:45 -0600
commitc96e88537de14bc17988d33cc25b77a52d7af6b4 (patch)
treeee53f22fb98903bfe38be3ae636b69a80e169b47 /src/database/models/comment.py
parent3fa4434d417c4bc85916ed79cc7bbb324b2768ac (diff)
Add reply model
Diffstat (limited to 'src/database/models/comment.py')
-rw-r--r--src/database/models/comment.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/database/models/comment.py b/src/database/models/comment.py
index 9501bba..d1ca868 100644
--- a/src/database/models/comment.py
+++ b/src/database/models/comment.py
@@ -1,4 +1,4 @@
-from sqlalchemy import BigInteger, String, DateTime, Text, ForeignKey
+from sqlalchemy import BigInteger, String, DateTime, Text, ForeignKey, Boolean
from sqlalchemy.orm import mapped_column, Mapped, relationship
from src.database import db
@@ -13,6 +13,9 @@ class Comment(db.Model):
author: Mapped[str] = mapped_column(String(128), nullable=True)
post: Mapped[str] = mapped_column(String(1024), nullable=False)
blog_id: Mapped[int] = mapped_column(ForeignKey('blogs.id'), index=True)
+ approved: Mapped[bool] = mapped_column(Boolean, nullable=False,
+ default=True)
blog = relationship('Blog', back_populates='comments')
+ replies = relationship('Reply', back_populates='comment')
created_at = mapped_column(DateTime)
updated_at = mapped_column(DateTime)