Skip to main content
Version: 1.0.0

ARShadesSubscriptions

Purpose​

The ARShadesSubscriptions collection manages subscription records for clients. Each document contains details about the subscription period, allowed domains and referrers, associated catalogues and services, consumption limits, status, and references to related entities. This collection is used to control access, enforce limits, and track the status of client subscriptions.

Document schema​

{
"clientRef": "string",
"endDate": "string",
"id": "string",
"isAllowIframe": "boolean",
"isMainSubscription": "boolean",
"list_allowed_domains": ["string"],
"list_allowed_referrers": ["string"],
"list_catalogues": {
"catalogLimit": "number",
"consumptionLimit": "number",
"list_catalogues_refs": ["string"],
"skuLimit": "number"
},
"list_consumptions": {
"arpdMeterConsumption": "string",
"consumptionRef": "string"
},
"list_services": ["string"],
"mainCatalogRef": "string",
"mainSubscriptionRef": "string",
"name": "string",
"notifications": [
{
"sendDate": "timestamp",
"type": "string"
}
],
"startDate": "string",
"status": "string",
"store": "string",
"subscriptionDetailsRef": "string",
"subscriptionType": "string",
"webUrl": "string"
}

Indexes​

  • clientRef is a string that refers to the ID of the Client collection;
  • id is a string that refers to the ID of this collection;
  • list_catalogues_refs is a [] of strings that refer to the IDs of the Catalogues collection;
  • consumptionRef is a string that refers to the ID of the Contatori_Brand collection;
  • list_services is a [] of strings that refer to the IDs of the Service_ARShades collection;
  • mainCatalogRef is a string that refers to the ID of the Catalogues collection;
  • mainSubscriptionRef is a string that refers to the ID of the ARShadesSubscriptions collection;

Query examples​

// Fetch the Reference Doc from Firebase
const subscriptionRefDoc = doc(db, "ARShadesSubscriptions", subscriptionsId);

// Get the Document Snapshot from the Reference Doc
const subscriptionRefSnap = await getDoc(subscriptionRefDoc);

// Query for active subscriptions
const subscriptionsByActiveStatus = query(
collection(db, "ARShadesSubscriptions"),
where("status", "==", "Active")
);

// Query subscriptions for a specific catalogue
const subscriptionsByCatalogue = query(
collection(db, "ARShadesSubscriptions"),
where("list_catalogues_refs", "array-contains", catalogueId)
);