Lista_Notification
Purpose
The Lista_Notification collection stores the relationship between a user (account) and a specific notification.
Its purpose is to track whether a notification has been delivered, read, and its current status.
Document schema
{
"accRef": {
"__ref__": "Profile/{profileId}"
},
"notificheRef": "string",
"readTime": "timestamp|null",
"sendTime": "string (ISO date)",
"status": "string"
}
Indexes
- accRef is a
referenceto a document in theProfilecollection; - notificheRef is a
stringreferencing the ID of a document in theNotificationscollection.
Query examples
// Fetch a specific notification status for a user
const listaNotificationRef = doc(db, "Lista_Notification", listaNotificationId);
const listaNotificationSnap = await getDoc(listaNotificationRef);
// Query all unread notifications for a user
const unreadNotifications = query(
collection(db, "Lista_Notification"),
where("accRef", "==", doc(db, "Profile", profileId)),
where("status", "==", "unread")
);
// Query by notification reference
const byNotificationRef = query(
collection(db, "Lista_Notification"),
where("notificheRef", "==", notificationId)
);