ppazos / cabolabs-ehrserver

Open platform to manage and share standardized clinical data, designed by @ppazos at CaboLabs Health Informatics.
https://cabolabs.com
Apache License 2.0
179 stars 110 forks source link

[API] Commit - add validation of the Version.uid.version_tree_id should be integer #922

Closed ppazos closed 6 years ago

ppazos commented 6 years ago

version_tree_id supports minor version and revision of semver like 1.2.3.

Since EHRServer supports lineal versioning and all versions should be final, we only allow major versions like 1, 2, 3, etc.

Currently we are not validating the version_tree_id is integer, and we parse it like it is when a new version number is generated.

  1. Validate version_tree_id is an integer and return an error from the commit if not.
  2. Then parse it and do +1 when generating a new version number.
ppazos commented 6 years ago

This is not really needed, now the version.uid is generated by the server on the creation, so 1 is assigned as version_tree_id.

Then modifications are committed with preceding_version_uid that should exists, and on that case the commit is accepted and the server updates the version_tree_id to 2, 3, and so on.

If the version_tree_id is not an integer, the version.uid will not exist.