DataSync Objects
The applications include different data entities that need to be synchronized. For example, orders, drawers, deposits, and terminal status. These entities may not have the same fields names, or keys, such as the field name with the time of the last update. Using the same field names leads to the impossibility of synchronization between the entities within the DataSync module, which is not intended to understand each type of object. The solution is to bring all data stored in the database into a single format using feeds and resources.
Feed Object
The Feed object represents a single collection within the database, which is analogous to a table in a relational database, and contains the following fields:
Field Name | Type | Description |
|---|---|---|
| string | The name of the collection |
| BehaviorSubject <Resource> | A collection representing a minimal set of data for synchronization |
Resource Object
The Resource object represents a single entity in the collection, which is analogous to a record in a relational database table, and contains the following fields:
Field Name | Type | Description |
|---|---|---|
| string | The identifier of the entity in the database |
| number | The time of the last change of the entity |
Objects Example
Based on each collection in the database that need to be synchronized, a collection of feeds is created with all the entities inside as resources. An example of the code snippet is shown below.
Order Feed: {
"name": "ordersStat",
"resources": [{
"id": "27c98301-9179-4a9c-8cf6-836a3686fc2",
"timeStamp": 1525440936663
}]
}As a result of the collection of feeds creation, you get a single data interface for synchronization without binding to any type of data.