feat: keep track of new messages

This commit is contained in:
Vlad Stan 2023-03-29 14:20:49 +03:00
parent 098cb5adf5
commit e04b9dc448
7 changed files with 32 additions and 1 deletions

14
crud.py
View file

@ -641,3 +641,17 @@ async def update_customer_profile(
f"UPDATE nostrmarket.customers SET event_created_at = ?, meta = ? WHERE public_key = ?",
(event_created_at, json.dumps(profile.dict()), public_key),
)
async def increment_customer_unread_messages(public_key: str):
await db.execute(
f"UPDATE nostrmarket.customers SET unread_messages = unread_messages + 1 WHERE public_key = ?",
(public_key,),
)
async def update_customer_no_unread_messages(public_key: str):
await db.execute(
f"UPDATE nostrmarket.customers SET unread_messages = 0 WHERE public_key = ?",
(public_key,),
)