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

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Status

Specification

DONE

Apiary
DONE
JSON Schema request

ABSENT

JSON Schema response
SPECS

Purpose

This WS  is design to update flags "is_active" for Medical Program.

APIary 

Deactivate Medical program

Input parameters 

  • id

Authorize

  1. Verify the validity of access token
  2. Check user scope (scope = 'medical_programs:write') in order to perform this action
    1. In case error - generate 401 response

Validate FKs

Purpose validation: Check on active program medication. Only medical program without active program medication can't be deactivated. In case on existing active program medication error must be shown.

  1. Check exist `program medication` by $.id & `is_active`=false
    1. if invalid - return 409 error (message: "There are active participants on this program. Only medical programs without participants can be deactivated.")

Validate PK Program Medications

Purpose validation: Check on existing record for Medical program

  1. Check exist `Medical_program` by $.id.

    1. if invalid - return 404 error (message: "Medical program with id={id} doesn't exist.")

Validate status

Purpose validation:  Medical program should be active (is_active == TRUE) 

  1. Validate `is_active` == TRUE
    1. if invalid  - return 409 error (message: "Medical program is not active and can't be deactivated again")

Deactivate Program Medications

Update medical program record by $.id  set values:

Destination

Source

is_active

FALSE

updated_at:timestamp
updated_byuser_id

Prepare & return response data structure

  1. Fill response WS data structure 
  2. Validate response using JSON schemas (!!! TBD)
    1. Return 422 with list of validation errors in case validation fails (422 EView) 


  • No labels