Notifications
Purpose
The Notifications collection defines the structure of system and workflow notifications.
Its purpose is to store variant-related alerts, status changes, and user-to-user communication logs.
Document schema
{
"brandId": "string",
"date": {
"__time__": "timestamp"
},
"declineRef": "string",
"nameVariant": "string",
"newStatus": "string",
"productId": "string",
"read": "boolean",
"sentBy": "string",
"sentTo": "string",
"skuModel": "string",
"type": "string",
"variantId": "string"
}
Indexes
- brandId is a
stringthat refers to the ID of theMainBrandscollection; - productId is a
stringthat refers to the ID of theProductscollection; - variantId is a
stringthat refers to the ID of theVariantscollection;
Query examples
// Fetch the Reference Doc from Firebase
const notificationRefDoc = doc(db, "Notifications", notificationId);
// Get the Document Snapshot from the Reference Doc
const notificationRefSnap = await getDoc(notificationRefDoc);
// Query notifications for a specific product
const notificationsByProduct = query(
collection(db, "Notifications"),
where("productId", "==", productId)
);
// Query notifications for a specific variant
const notificationsByVariant = query(
collection(db, "Notifications"),
where("variantId", "==", variantId)
);