Dashboard_Notification
Purpose
The Dashboard_Notification collection stores notifications related to review and validation actions inside the platform.
Its purpose is to keep track of pending actions, review requests, and status updates related to models, glasses, and sizes.
Document schema
{
"account": "ref:Profile",
"action": "string",
"glassesRef": "ref:Occhiale",
"modelRef": "ref:Modello",
"readTime": "timestamp|null",
"sendTime": "timestamp",
"status": "string",
"subject": "string",
"taglia": "ref:Taglia",
"type": "string"
}
Indexes
- account is a reference to the
Profilecollection; - glassesRef is a reference to the
Occhialecollection; - modelRef is a reference to the
Modellocollection; - taglia is a reference to the
Tagliacollection.
Query examples
// Fetch the Reference Doc from Firebase
const notificationRefDoc = doc(db, "Dashboard_Notification", notificationId);
const notificationSnap = await getDoc(notificationRefDoc);
// Query unread notifications for a specific account
const unreadNotifications = query(
collection(db, "Dashboard_Notification"),
where("account", "==", doc(db, "Profile", profileId)),
where("status", "==", "unread")
);
// Query notifications by model reference
const modelNotifications = query(
collection(db, "Dashboard_Notification"),
where("modelRef", "==", doc(db, "Modello", modelId))
);
// Mark a notification as read
await updateDoc(doc(db, "Dashboard_Notification", notificationId), {
status: "read",
readTime: new Date()
});