Skip to main content
Version: 1.0.0

Profile

Purpose​

The Profile collection defines the structure of an individual user profile.
Its purpose is to store authentication data, user information, catalog associations, orders, and access references.

Document schema​

{
"_email": "string",
"accountCreationDate": {
"__time__": "timestamp"
},
"avatarURL": "string",
"canPlaceOrders": "boolean",
"catalogsList": ["string"],
"clientRef": "string",
"firstName": "string",
"lastName": "string",
"orderList": ["any"],
"ref_log_access": "string",
"role": "string"
}

Indexes​

  • clientRef is a reference to Client collection;
  • catalogsList is a references to Brand collection;
  • ref_log_access is a reference to Log_Loading_Models collection;

Query examples​

// Fetch the Reference Doc from Firebase
const profileRefDoc = doc(db, "Profile", profileId);

// Get the Document Snapshot from the Reference Doc
const profileRefSnap = await getDoc(profileRefDoc);

// Query profiles by client reference
const profilesByClient = query(
collection(db, "Profile"),
where("clientRef", "==", doc(db, "Client", clientId))
);

// Query profiles by associated catalog
const profilesByCatalogue = query(
collection(db, "Profile"),
where("catalogsList", "array-contains", catalogueId)
);