-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Binary UUID Conversion Process #321
Comments
This makes a lot of sense - JavaScript doesn't really need to know the uuids are binary until needing to interact with the database. Happy to see this improvement. |
This commit bring the receipt core branch up to date with master, updating all of the outdated references to features that have been updated. * Updated invoice receipt example to work with binary uuids * Resolved conflicts with uuid library * Removed describe.only from end to end tests This commit also implements the suggested binary UUID conversion structure described in [#321](#321). This ensures that all controllers using UUIDs to make internal requests can assume they are working with strings. (Moves conversations to the SQL query step).
This commit bring the receipt core branch up to date with master, updating all of the outdated references to features that have been updated. * Updated invoice receipt example to work with binary uuids * Resolved conflicts with uuid library * Removed describe.only from end to end tests This commit also implements the suggested binary UUID conversion structure described in [#321](#321). This ensures that all controllers using UUIDs to make internal requests can assume they are working with strings. (Moves conversations to the SQL query step).
@IMA-WorldHealth/local-contributors What would you think of a helper conversion function that converts uuids to binary if they exist, based on an array of keys? For example: let data = req.body;
// do some logic
// convert the 'uuid' and 'debtor_uuid' properties to binary using db.bid()
data = db.convert(data, ['uuid', 'debtor_uuid']);
// now I can db.exec('INSERT...') or db.exec('UPDATE ...') easily. It might help clean up the code a bit. |
This could provide useful functionality. I would still suggest that this is only done directly before reading or writing to the database - not immediately as the body is received. The reason for this is passing req.body around with strings allows the controllers to easily access and pass values to other required controllers without considering if it a string or binary. |
@sfount, I agree. Our logs with also be more readable the longer we avoid binary data. I'll look into implementing this in a PR soon. |
This commit implements `db.convert()` to convert hexadecimal strings on objects into binary representation for insertion into the database. It is demonstrated on both the patient groups controller and enterprises controller. It is used as described here: Third-Culture-Software#321 (comment) ```js let data = req.body; // do some logic // convert the 'uuid' and 'debtor_uuid' properties to binary using // db.bid() data = db.convert(data, ['uuid', 'debtor_uuid']); // now I can db.exec('INSERT...') or db.exec('UPDATE ...') easily. It might help clean up the code a bit. ```
This commit implements `db.convert()` to convert hexadecimal strings on objects into binary representation for insertion into the database. It is demonstrated on both the patient groups controller and enterprises controller. It is used as described here: Third-Culture-Software#321 (comment) ```js let data = req.body; // do some logic // convert the 'uuid' and 'debtor_uuid' properties to binary using // db.bid() data = db.convert(data, ['uuid', 'debtor_uuid']); // now I can db.exec('INSERT...') or db.exec('UPDATE ...') easily. It might help clean up the code a bit. ```
This commit implements `db.convert()` to convert hexadecimal strings on objects into binary representation for insertion into the database. It is demonstrated on both the patient groups controller and enterprises controller. It is used as described here: Third-Culture-Software#321 (comment) ```js let data = req.body; // do some logic // convert the 'uuid' and 'debtor_uuid' properties to binary using // db.bid() data = db.convert(data, ['uuid', 'debtor_uuid']); // now I can db.exec('INSERT...') or db.exec('UPDATE ...') easily. It might help clean up the code a bit. ```
This commit implements `db.convert()` to convert hexadecimal strings on objects into binary representation for insertion into the database. It is demonstrated on both the patient groups controller and enterprises controller. It is used as described here: Third-Culture-Software#321 (comment) ```js let data = req.body; // do some logic // convert the 'uuid' and 'debtor_uuid' properties to binary using // db.bid() data = db.convert(data, ['uuid', 'debtor_uuid']); // now I can db.exec('INSERT...') or db.exec('UPDATE ...') easily. It might help clean up the code a bit. ```
This commit implements `db.convert()` to convert hexadecimal strings on objects into binary representation for insertion into the database. It is demonstrated on both the patient groups controller and enterprises controller. It is used as described here: Third-Culture-Software#321 (comment) ```js let data = req.body; // do some logic // convert the 'uuid' and 'debtor_uuid' properties to binary using // db.bid() data = db.convert(data, ['uuid', 'debtor_uuid']); // now I can db.exec('INSERT...') or db.exec('UPDATE ...') easily. It might help clean up the code a bit. ```
This commit implements `db.convert()` to convert hexadecimal strings on objects into binary representation for insertion into the database. It is demonstrated on both the patient groups controller and enterprises controller. It is used as described here: #321 (comment) ```js let data = req.body; // do some logic // convert the 'uuid' and 'debtor_uuid' properties to binary using // db.bid() data = db.convert(data, ['uuid', 'debtor_uuid']); // now I can db.exec('INSERT...') or db.exec('UPDATE ...') easily. It might help clean up the code a bit. ```
This commit removes all custom convert() methods from server controllers, preferring to use db.convert() to change uuids from hex into binary values before database insertion. Closes #321.
This commit removes all custom convert() methods from server controllers, preferring to use db.convert() to change uuids from hex into binary values before database insertion. Closes #321.
This commit removes all custom convert() methods from server controllers, preferring to use db.convert() to change uuids from hex into binary values before database insertion. Closes #321.
This commit removes all custom convert() methods from server controllers, preferring to use db.convert() to change uuids from hex into binary values before database insertion. Closes #321.
This commit removes all custom convert() methods from server controllers, preferring to use db.convert() to change uuids from hex into binary values before database insertion. Closes #321.
This commit removes all custom convert() methods from server controllers, preferring to use db.convert() to change uuids from hex into binary values before database insertion. Closes #321.
3530: Update snyk to the latest version 🚀 r=jniles a=greenkeeper[bot] ## The dependency [snyk](https://github.com/snyk/snyk) was updated from `1.120.1` to `1.121.0`. This version is **not covered** by your **current version range**. If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update. --- <details> <summary>Release Notes for v1.121.0</summary> <h1><a href="https://urls.greenkeeper.io/snyk/snyk/compare/v1.120.1...v1.121.0">1.121.0</a> (2019-01-08)</h1> <h3>Features</h3> <ul> <li>Split dockerfile / base image vulns (<a href="https://urls.greenkeeper.io/snyk/snyk/commit/b2f530d">b2f530d</a>)</li> </ul> </details> <details> <summary>Commits</summary> <p>The new version differs by 4 commits.</p> <ul> <li><a href="https://urls.greenkeeper.io/snyk/snyk/commit/ecac358cc1da7cee3715e709cfa368838c598af6"><code>ecac358</code></a> <code>Merge pull request #313 from snyk/feat/docker-split-user-base-vulns</code></li> <li><a href="https://urls.greenkeeper.io/snyk/snyk/commit/b2f530db922c85eed0de6139512e6eb83cb174fa"><code>b2f530d</code></a> <code>feat: Split dockerfile / base image vulns</code></li> <li><a href="https://urls.greenkeeper.io/snyk/snyk/commit/5f6083bb2f4dd80ecd7a3f4f7c8a16aa00f7eb58"><code>5f6083b</code></a> <code>Merge pull request #321 from snyk/chore/disable-lockfile-creation</code></li> <li><a href="https://urls.greenkeeper.io/snyk/snyk/commit/95be92c862655fdda539056893336c4eb05582e3"><code>95be92c</code></a> <code>chore: Disable lockfile creation</code></li> </ul> <p>See the <a href="https://urls.greenkeeper.io/snyk/snyk/compare/5938f576c782762d1cbaa9cd4d10afa7dde3b91b...ecac358cc1da7cee3715e709cfa368838c598af6">full diff</a></p> </details> <details> <summary>FAQ and help</summary> There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new). </details> --- Your [Greenkeeper](https://greenkeeper.io) bot 🌴 Co-authored-by: greenkeeper[bot] <greenkeeper[bot]@users.noreply.github.com>
3530: Update snyk to the latest version 🚀 r=jniles a=greenkeeper[bot] ## The dependency [snyk](https://github.com/snyk/snyk) was updated from `1.120.1` to `1.121.0`. This version is **not covered** by your **current version range**. If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update. --- <details> <summary>Release Notes for v1.121.0</summary> <h1><a href="https://urls.greenkeeper.io/snyk/snyk/compare/v1.120.1...v1.121.0">1.121.0</a> (2019-01-08)</h1> <h3>Features</h3> <ul> <li>Split dockerfile / base image vulns (<a href="https://urls.greenkeeper.io/snyk/snyk/commit/b2f530d">b2f530d</a>)</li> </ul> </details> <details> <summary>Commits</summary> <p>The new version differs by 4 commits.</p> <ul> <li><a href="https://urls.greenkeeper.io/snyk/snyk/commit/ecac358cc1da7cee3715e709cfa368838c598af6"><code>ecac358</code></a> <code>Merge pull request #313 from snyk/feat/docker-split-user-base-vulns</code></li> <li><a href="https://urls.greenkeeper.io/snyk/snyk/commit/b2f530db922c85eed0de6139512e6eb83cb174fa"><code>b2f530d</code></a> <code>feat: Split dockerfile / base image vulns</code></li> <li><a href="https://urls.greenkeeper.io/snyk/snyk/commit/5f6083bb2f4dd80ecd7a3f4f7c8a16aa00f7eb58"><code>5f6083b</code></a> <code>Merge pull request #321 from snyk/chore/disable-lockfile-creation</code></li> <li><a href="https://urls.greenkeeper.io/snyk/snyk/commit/95be92c862655fdda539056893336c4eb05582e3"><code>95be92c</code></a> <code>chore: Disable lockfile creation</code></li> </ul> <p>See the <a href="https://urls.greenkeeper.io/snyk/snyk/compare/5938f576c782762d1cbaa9cd4d10afa7dde3b91b...ecac358cc1da7cee3715e709cfa368838c598af6">full diff</a></p> </details> <details> <summary>FAQ and help</summary> There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new). </details> --- Your [Greenkeeper](https://greenkeeper.io) bot 🌴 Co-authored-by: greenkeeper[bot] <greenkeeper[bot]@users.noreply.github.com>
3530: Update snyk to the latest version 🚀 r=jniles a=greenkeeper[bot] ## The dependency [snyk](https://github.com/snyk/snyk) was updated from `1.120.1` to `1.121.0`. This version is **not covered** by your **current version range**. If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update. --- <details> <summary>Release Notes for v1.121.0</summary> <h1><a href="https://urls.greenkeeper.io/snyk/snyk/compare/v1.120.1...v1.121.0">1.121.0</a> (2019-01-08)</h1> <h3>Features</h3> <ul> <li>Split dockerfile / base image vulns (<a href="https://urls.greenkeeper.io/snyk/snyk/commit/b2f530d">b2f530d</a>)</li> </ul> </details> <details> <summary>Commits</summary> <p>The new version differs by 4 commits.</p> <ul> <li><a href="https://urls.greenkeeper.io/snyk/snyk/commit/ecac358cc1da7cee3715e709cfa368838c598af6"><code>ecac358</code></a> <code>Merge pull request #313 from snyk/feat/docker-split-user-base-vulns</code></li> <li><a href="https://urls.greenkeeper.io/snyk/snyk/commit/b2f530db922c85eed0de6139512e6eb83cb174fa"><code>b2f530d</code></a> <code>feat: Split dockerfile / base image vulns</code></li> <li><a href="https://urls.greenkeeper.io/snyk/snyk/commit/5f6083bb2f4dd80ecd7a3f4f7c8a16aa00f7eb58"><code>5f6083b</code></a> <code>Merge pull request #321 from snyk/chore/disable-lockfile-creation</code></li> <li><a href="https://urls.greenkeeper.io/snyk/snyk/commit/95be92c862655fdda539056893336c4eb05582e3"><code>95be92c</code></a> <code>chore: Disable lockfile creation</code></li> </ul> <p>See the <a href="https://urls.greenkeeper.io/snyk/snyk/compare/5938f576c782762d1cbaa9cd4d10afa7dde3b91b...ecac358cc1da7cee3715e709cfa368838c598af6">full diff</a></p> </details> <details> <summary>FAQ and help</summary> There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new). </details> --- Your [Greenkeeper](https://greenkeeper.io) bot 🌴 3537: fix(journal): preserve trans_id_reference_number r=jniles a=jniles We now remember the trans_id_reference_number when we create new lines in a transaction. This means we no longer error when trying to add new lines to a transaction. Note that we still need to add a test. Partially addresses #3536. Co-authored-by: greenkeeper[bot] <greenkeeper[bot]@users.noreply.github.com> Co-authored-by: Jonathan Niles <[email protected]>
3530: Update snyk to the latest version 🚀 r=jniles a=greenkeeper[bot] ## The dependency [snyk](https://github.com/snyk/snyk) was updated from `1.120.1` to `1.121.0`. This version is **not covered** by your **current version range**. If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update. --- <details> <summary>Release Notes for v1.121.0</summary> <h1><a href="https://urls.greenkeeper.io/snyk/snyk/compare/v1.120.1...v1.121.0">1.121.0</a> (2019-01-08)</h1> <h3>Features</h3> <ul> <li>Split dockerfile / base image vulns (<a href="https://urls.greenkeeper.io/snyk/snyk/commit/b2f530d">b2f530d</a>)</li> </ul> </details> <details> <summary>Commits</summary> <p>The new version differs by 4 commits.</p> <ul> <li><a href="https://urls.greenkeeper.io/snyk/snyk/commit/ecac358cc1da7cee3715e709cfa368838c598af6"><code>ecac358</code></a> <code>Merge pull request #313 from snyk/feat/docker-split-user-base-vulns</code></li> <li><a href="https://urls.greenkeeper.io/snyk/snyk/commit/b2f530db922c85eed0de6139512e6eb83cb174fa"><code>b2f530d</code></a> <code>feat: Split dockerfile / base image vulns</code></li> <li><a href="https://urls.greenkeeper.io/snyk/snyk/commit/5f6083bb2f4dd80ecd7a3f4f7c8a16aa00f7eb58"><code>5f6083b</code></a> <code>Merge pull request #321 from snyk/chore/disable-lockfile-creation</code></li> <li><a href="https://urls.greenkeeper.io/snyk/snyk/commit/95be92c862655fdda539056893336c4eb05582e3"><code>95be92c</code></a> <code>chore: Disable lockfile creation</code></li> </ul> <p>See the <a href="https://urls.greenkeeper.io/snyk/snyk/compare/5938f576c782762d1cbaa9cd4d10afa7dde3b91b...ecac358cc1da7cee3715e709cfa368838c598af6">full diff</a></p> </details> <details> <summary>FAQ and help</summary> There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new). </details> --- Your [Greenkeeper](https://greenkeeper.io) bot 🌴 Co-authored-by: greenkeeper[bot] <greenkeeper[bot]@users.noreply.github.com>
Currently server API helper functions that execute SQL expect a binary UUID (buid) to be passed in as a parameter and this is directly templated into the SQL.
I propose that in general we should minimise the use of the binary format in JavaScript itself, that means that all controllers and methods should assume we dealing with strings (as passed from the client) and the conversion takes place at the last possible point (just before the SQL is executed).
For example:
Invoice Receipt Controller
Invoice Controller
Pros:
Cons:
The text was updated successfully, but these errors were encountered: