Data Synchronisation
Details the sync processes needed to maintain the best user experience.
Initial synchronisation
When the user completes a login for the first time an initial synchronisation is started.
The request flow to complete are:
- Search for account based on personal Id, which returns a list of accountId's.
- Fetch all Users based on the
accountId
. - Fetch all Locations and Services based on the
accountId
. - Fetch Agreements and Products for each
serviceId
.
Account synchronisation
After the initial synchronisation we need to constantly sync account data so the users data is
up to date. An account synchronisation is point 1, 2, 3 in the Initial synchronisation flow.
This can be done in three different ways:
- Fetch account data during login from the Organisation Kit implementation.
- The Organisation makes a request to Sync Account to trigger an account sync.
- Setup scheduled jobs to run nightly that call Sync Account for each customerId.
Invoice synchronisation
Invoices are treated differently than location and user/role data.
Invoices have different states which affect how a user should treat the invoice; new, paid and overdue. In order to send push notifications to prompt users to take action the appropriate action, invoices are fetched via background jobs scheduled during daytime hours by Bright Energy.
Bright requires at minimum the two most recent invoices for the synchronisation. Therefore the fromDate and toDate query parameters in Get account invoices must be implemented so we can guarantee an accurate app experience for your users.
If your invoice service is sensitive to when invoice data is requested, you can alternatively trigger Sync Account calls when the invoice data should be fetched. This also gives you control on when push notifications are sent out.
Measurement and Invoice data
Measurements and Invoice data is not stored in the Bright cache for the following reasons:
- to make sure that only the latest values are
shown in the app - to avoid large dataset synchronisations outside of user interactions
Updated 1 day ago