fix: change push.register return type to tuple and only send welcome notification on new registration

This commit is contained in:
2026-05-28 22:49:37 +00:00
parent 4cdf49cf8f
commit ab4861562b
2 changed files with 9 additions and 8 deletions
+3 -3
View File
@@ -250,7 +250,7 @@ async def notify_user(user_uid: str, payload: dict[str, Any]) -> None:
async def register(
user_uid: str, endpoint: str, key_auth: str, key_p256dh: str
) -> dict[str, Any]:
) -> tuple[dict[str, Any], bool]:
table = get_table("push_registration")
existing = table.find_one(
user_uid=user_uid,
@@ -261,7 +261,7 @@ async def register(
)
if existing:
logger.debug("Push subscription already registered for user %s", user_uid)
return existing
return existing, False
record = {
"uid": generate_uid(),
@@ -274,4 +274,4 @@ async def register(
}
table.insert(record)
logger.info("Registered push subscription for user %s", user_uid)
return record
return record, True