ЕСОЗ - публічна документація

RC [WP] Deactivate Group of Diagnoses_EN

Purpose

This WS allows to deactivate a Group of Diagnoses from Admin panel.

Key points

  1. This is a graphQl method used in Administration panel only.

  2. Only authenticated and authorized NHS employee with appropriate scope can deactivate a Group of Diagnoses.

  3. Only active Groups of Diagnoses can be deactivated.

Specification

"Deactivates a single `DiagnosesGroup` using its globally unique ID." deactivateDiagnosesGroup( input: DeactivateDiagnosesGroupInput! ): DeactivateDiagnosesGroupPayload
""" Input for `deactivateDiagnosesGroup` mutation. User must have a scope **diagnoses_group:write** """ input DeactivateDiagnosesGroupInput { "Globally unique ID of the `DiagnosesGroup` which should be deactivated." id: ID! }
""" Return type for `deactivateDiagnosesGroup` mutation. """ type DeactivateDiagnosesGroupPayload { "Deactivated `DiagnosesGroup`." diagnosesGroup: DiagnosesGroup }

Authorization

  • Verify the validity of access token

    • in case of error - return 401 (“Invalid access token”) in case of validation fails

  • Verify that token is not expired

    • in case of error - return 401 (“Invalid access token”)

  • Check user scopes in order to perform this action (scope = 'diagnoses_group:write')

    • return 403 (“Your scope does not allow to access this resource. Missing allowances: diagnoses_group:write”) in case of invalid scope(s)

Validate legal entity

  • Extract client_id from token.

  • Check client scopes in order to perform this action (scope = 'diagnoses_group:write')

    • in case of error - return 403 (“Your scope does not allow to access this resource. Missing allowances: diagnoses_group:write”)

  • Check client_type = NHS

    • in case of error - return 403 ('You don’t have permission to access this resource')

  • Check legal entity status (status = ACTIVE)

    • In case of error - return 409 ('client_id refers to legal entity that is not active')

Validate request

  • Check if diagnoses_group_id is submitted

    • in case if not submitted - return 422 ('required property diagnoses_group_id was not present')

    • in case if not exist or not active - return 404 ('not found')

  • Check if deactivation_reason is submitted

    • in case of error - return 422 ('required property deactivation_reason was not present')

Service logic

  1. Update data:

    1. diagnoses_groups table

      1. set is_active = false

      2. set deactivation_reason = $.deactivation_reason

      3. set updated_at, updated_by

  2. Deactivate all approvals with approval.diagnoses_group_id = $.diagnoses_group_id

ЕСОЗ - публічна документація