I would like to make an offline-first To-do app which works on both the mobile app (SQLite) and the web app (PostgreSQL). The app will have these business models:
User:
- id
- name
- created_datetime
Todo:
- id
- user_id
- title
- done
- created_datetime
- updated_datetime
Creating new users:
- Only can create a new user with the web app.
Creating new to-dos:
- Can create to-do with the web app.
- If the mobile app is online, post the to-do on the web app. If the post was successful, create the to-do with the same successful to-do's
id
in the mobile app as well.
- If the mobile app is offline, still create the new to-do, and update/post the new to-do to the web app, whenever it is online again.
I am unsure how to create a new to-do if the mobile is offline and if I don't have any id, to begin with. If I create a dummy ID for the mobile app, it may clash with other to-do ids. Or should I use UUID for all my to-do's id in the mobile app, and then post it to the web app? How does other offline-first app database design work?
Asked by Robin
(151 rep)
Dec 27, 2022, 07:19 AM
Last activity: Jan 27, 2023, 05:30 AM
Last activity: Jan 27, 2023, 05:30 AM