Skip to main content
Version: 1.0.0

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 string that refers to the ID of the MainBrands collection;
  • productId is a string that refers to the ID of the Products collection;
  • variantId is a string that refers to the ID of the Variants collection;

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)
);