I am currently building an ordering application where users can send orders for available items. It must have the functionality to work offline as well. After user is online, the user has the sync button to sync his orders with the back-end. In the device I'm planning to use SQLite. It has the entities like orders and order items.
Currently I'm stuck with the problem of syncing.
I planned it like this. When the user clicks the sync button and if the app is online the newly updated and created fields on the back-end database data is returned to the app (the app sends the last sync time to the back-end). Then the app compares its data with the returned data (with created_at, updated_at time fields). Then sends the newly updated data to the back-end and update the current local database.
There can be conflicts with the back-end database. I'm trying to resolve conflicts in the app it self.
How to solve this issue. Is there any service that already implemented to solve this issue in React Native?