Enquiry Number Generation
Introduction
To generate a sequential number counter that functions as an enquiry identifier when creating enquiries of any type across the platform. This modification ensures that the enquiry number, previously unique to a lease company, will now be unique at the ViSN level.
Technique Overview
To generate the sequence enquiry number, distributed counter technique will be used. More about this can be found in link provided in references
Setup
A collection will be created containing a predefined set of documents, where each document will be assigned a sequential number as its unique document Id.
Each document will have a field
count
with value 0.Firestore Location of enquiry number counter
/ancillary/counters/enquiryNumber
Working
To increment the counter, pick a document at random and increment the count of that document.
To get the next enquiry number, sum the values in each document. This will be the next enquiry number.
Abandoned Enquiries
If a generated enquiry number remains unused for any reason, it will be categorised as an abandoned enquiry number.
These enquiries will be stored in location /ancillary/abandonedEnquiries/enquiries
in firestore.
References
- Distributed counters: https://firebase.google.com/docs/firestore/solutions/counters
Status: Accepted
Category: Protected
Authored By: Gladson on May 15, 2023
Revisions