Swimlanes.io is a free webapp for making sequence diagrams. You simply edit the text on the left and the diagram is updated in real time. You can download your sequence diagrams as images or distribute with a link.
Title: NoSequel: Client CRUD API note Client, Backend: **Serialization Schema** ``` destination: <uid>-<iid>-<colName> //not encrypted operation: c/r/u/d //encrypted payload : [escape-left-curley-bracket] JSON payload } //encrypted. username: xxx //plain password: xxx //encrypted ``` Encryption is done using the iid's AES hashkey. - How will the backend know the decryption key? Recall, on the backend, every `index` stores a `hashKey` that is used for decrypting the contents of that `index`. The `destination` provided by the user can be used to find the `index` the user is using, and subsequently be used to find associated `hashKey` used for decryption. _: **1. CREATE** note User, Data store: - Create a new document User -> Client: Method call note: - `Collection.Create(data)` Client -> Backend: POST note: - Serialize the payload to look like the Serialization Schema up there. - Operation is `c` - `/create` Backend -> Data store: note: - Follow the `destination` path to the file. - Every document (the individual database data object) has a unique id. The id is of the form `<uid>-<iid>-<colName>-<did>` where `did` is the document ID. - A new `did` is the next largest integer id. Call this document ID `docID`. Embed `docID`. Data store -> User: note: - Return a JSON object with the data with `docID` embedded. _: **2. READ** note User, Data store: - Read a new document User -> Client: Method call note: - `Collection.Read(document_id)` - Here `document_id` refers to the unique id assigned to every document. - If `document_id` not provided, we'll assume the user wants the entire `Collection`. - We'll support basic operations for now, and improve with more robust features later. Client -> Backend: GET note: - Serialize the payload to look like the Serialization Schema up there. - Operation is `r` - `/read` Backend -> Data store: note: - Follow the `destination` path to the file. - Every document (the individual database data object) has a unique id. The id is of the form `<uid>-<iid>-<colName>-<did>` where `did` is the document ID. Pull out the one corresponding to the query Data store -> User: note: - Return a JSON object with the data. - If the query object is not found, return a 404 error. _: **3. UPDATE** note User, Data store: - Update a document User -> Client: Method call note: - `Collection.Update(document_id, updated_obj)` - Here `document_id` refers to the unique id assigned to every document. If `document_id` not provided, throw an error. - Here `updated_obj` is an object with updated fields, of type `interface{}` (the generic typeless data structure, analagous to the `any` type). User will have to create this object themselves then pass a copy of it here. - `updated_obj` CANNOT update the assigned unique document id, called `docId`. We'll check for this on the backend. Client -> Backend: PUT note: - Serialize the payload to look like the Serialization Schema up there. - The payload will look like (variable names to be refined): ``` { target_document: xxx //which document are we updating? updated_obj : {JSON} //update target_document to this } ``` - Operation is `u` - `/upload` Backend -> Client: ERROR note: - User may not update the `docId` field, we'll throw an error if we see that Backend -> Data store: note: - Every document (the individual database data object) has a unique id. The id is of the form `<uid>-<iid>-<colName>-<did>` where `did` is the document ID. Pull out the one corresponding to the query then update it. Data store -> User: note: - Return a JSON object with the updated data. - If the query object is not found, return a 404 error. _: **4. DELETE** note User, Data store: - Delete a document User -> Client: Method call note: - `Collection.Delete(document_id)` - Here `document_id` refers to the unique id assigned to every document. If `document_id` not provided, throw an error. Client -> Backend: PUT note: - Serialize the payload to look like the Serialization Schema up there. - Operation is `d` - `/delete` Backend -> Data store: note: - Every document (the individual database data object) has a unique id. The id is of the form `<uid>-<iid>-<colName>-<did>` where `did` is the document ID. Pull out the one corresponding to the query then delete it. Data store -> User: note: - Return a JSON object with the deleted data. At this point this data is already deleted in the database. - If the query object is not found, return a 404 error.