summaryrefslogtreecommitdiff
path: root/src/queries/comments_query.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/queries/comments_query.py')
-rw-r--r--src/queries/comments_query.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/queries/comments_query.py b/src/queries/comments_query.py
index dca4694..e343667 100644
--- a/src/queries/comments_query.py
+++ b/src/queries/comments_query.py
@@ -1,5 +1,5 @@
from src.database import db
-from src.database.models import Comment
+from src.database.models import Comment, Reply
from src.queries.base_query import BaseQuery
@@ -12,5 +12,10 @@ class CommentsQuery(BaseQuery):
def comments_of_post(self, post):
return db.paginate(
- db.select(Comment).where(Comment.post == post).order_by(Comment.created_at.desc()),
+ db.select(Comment).where(Comment.post == post).order_by(Comment.created_at.desc())
+ )
+
+ def replies_of(self, comment_id):
+ return db.paginate(
+ db.select(Reply).where(Reply.comment_id == comment_id).order_by(Reply.created_at.desc())
)