Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

...

  • Check that value is in allowed active values from device_definition_classification_type dictionary.

    • in case of error - return 422 ('value is not allowed in enum')

...

  • Check that $.properties.type is in allowed values from device_properties dictionary.

    • in case of error - return 422 ('value is not allowed in enum')

  • Check $.properties.value[x] is one of the following: value_integer, value_decimal, value_boolean, value_string

    • in case of value[x] is missing - return 422 ('One and only one key is allowed from the list: [value_integer, value_decimal, value_boolean, value_string], but the following are present: [].')

    • in case of more than one value[x] provided - return 422 ('One and only one key is allowed from the list: [value_integer, value_decimal, value_boolean, value_string], but the following are present: [value[x], value[x], …].')

    • in case of value[x] is provided with incorrect type - return 422 ('type mismatch. Expected <expected_type> but got <actual_type>')

  • Check config DEVICE_PROPERTY_DICTIONARIES - if device property is associated with dictionary in this configuration parameter

    • only value_string is allowed for this property

      • in case of error - return 422 ('Only value_string is allowed for dictionary values')

    • check that value_string is one of the corresponding dictionary for this property

      • in case of error - return 422 ('value is not allowed in enum')

11. Validate inventory number

...

  1. Save equipment record to the prm.equipments table (see RC_[NEW] Equipment status model) with the following:

    1. id = generate uuid

    2. inventory_number = $.inventory_number

    3. serial_number = $.serial_number

    4. device_definition_id = $.device_definition_id

    5. status = $.status

    6. error_reason = null

    7. availability_status = $.availability_status

    8. manufacturer = $.manufacturer

    9. manufacture_date = $.manufacture_date

    10. model_number = $.model_number

    11. type = $.type

    12. properties = $.properties

    13. legal_entity_id = $.token.client_id

    14. division_id = $.division_id

    15. note = $.note

    16. parent_id = $.parent_id

    17. lot_number = $.lot_number

    18. expiration_date = $.expiration_date

    19. udi = $.udi

    20. is_active = true

    21. recorder = $.recorder

    22. inserted_at = current datetime

    23. inserted_by = user_id from token

    24. updated_at = current datetime

    25. updated_by = user_id from token

  2. Insert each name from $.names into prm.equipment_names with the following:

    1. id = generate uuid

    2. equipment_id = reference to equipment

    3. type = $.names.type

    4. name = $.names.name

    5. inserted_at = current datetime

    6. inserted_by = user_id from token

    7. updated_at = current datetime

    8. updated_by = user_id from token