This commit is contained in:
@@ -5,6 +5,10 @@ from services.db import local_session
|
||||
from services.schema import mutation, query
|
||||
from orm.notification import Notification
|
||||
|
||||
# TODO: occurrencies?
|
||||
|
||||
# TODO: use of Author.id?
|
||||
|
||||
|
||||
@query.field("loadNotifications")
|
||||
@login_required
|
||||
@@ -16,12 +20,7 @@ async def load_notifications(_, info, params=None):
|
||||
|
||||
limit = params.get("limit", 50)
|
||||
offset = params.get("offset", 0)
|
||||
q = (
|
||||
select(Notification)
|
||||
.order_by(desc(Notification.created_at))
|
||||
.limit(limit)
|
||||
.offset(offset)
|
||||
)
|
||||
q = select(Notification).order_by(desc(Notification.created_at)).limit(limit).offset(offset)
|
||||
|
||||
notifications = []
|
||||
with local_session() as session:
|
||||
@@ -39,8 +38,8 @@ async def load_notifications(_, info, params=None):
|
||||
|
||||
return {
|
||||
"notifications": notifications,
|
||||
"totalCount": total_count,
|
||||
"totalUnreadCount": total_unread_count,
|
||||
"total": total_count,
|
||||
"unread": total_unread_count,
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user