Skip to content

Instantly share code, notes, and snippets.

@fairchild
Created March 31, 2016 07:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fairchild/1e2b06916e51261f52db494373b68c59 to your computer and use it in GitHub Desktop.
Save fairchild/1e2b06916e51261f52db494373b68c59 to your computer and use it in GitHub Desktop.
sync flow for data created on mobile first
title Create Data Mobile First
participant mobile as m
participant server as s
participant database as db
m -> m: create item {uuid}
m -> s: POST item {uuid}
s -> db: begin transaction
s -> db: SELECT id, uuid WHERE uuid={uuid} from write_log
alt if not found
db --> s: id
s -> db: insert item_type, id, uuid
db --> s: ok, commit transaction
s --> m: 201, id, uuid
end
alt if found
db --> s: found uuid
s --> m: 200, id, uuid, etc...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment