remotes/1693045480750635534/spooky-22
Aevann1 2022-01-22 01:04:10 +02:00
parent 0e39f938be
commit ad75fbc874
1 changed files with 18 additions and 0 deletions

View File

@ -14,6 +14,24 @@ def clear(v):
g.db.commit()
return {"message": "Notifications cleared!"}
@app.get("/unread")
@auth_required
def unread(v):
listing = g.db.query(Comment).join(Notification.comment).filter(
Notification.read == False,
Notification.user_id == v.id,
Comment.is_banned == False,
Comment.deleted_utc == 0,
Comment.author_id != AUTOJANNY_ID,
).order_by(Notification.id.desc()).all()
for n in v.notifications.filter_by(read=False).all():
n.read = True
g.db.add(n)
g.db.commit()
return {"data":[x.json for x in listing]}
@app.get("/notifications")
@auth_required
def notifications(v):