...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
Schema
Features
Input parameters
Authorize
- Check user scope (scope = 'program_service:write') in order to perform this action
- In case error - generate 401 response
...
Purpose
This WS is designed to deactivate program service.
Specification
Schema:
Expand |
---|
title | programServices.graphql |
---|
|
Code Block |
---|
| """
Fields to filter program services in the system.
"""
input ProgramServiceFilter {
"Primary key identifier from the database."
databaseId: UUID
"Medical program filter."
medicalProgram: MedicalProgramFilter
"Flag whether `ProgramService` is active or not?"
isActive: Boolean
"Service request allowed status"
requestAllowed: Boolean
"Service filter"
service: ServiceFilter
"Service Group filter"
serviceGroup: ServiceGroupFilter
}
"""
Methods to use when ordering `ProgramService`.
"""
enum ProgramServiceOrderBy {
"Sort by consumerPrice in ascending order"
CONSUMER_PRICE_ASC
"Sort by consumerPrice in descending order"
CONSUMER_PRICE_DESC
"Sort by inserted_at in ascending order."
INSERTED_AT_ASC
"Sort by inserted_at in descending order."
INSERTED_AT_DESC
}
"""
A connection to a list of `ProgramService` items.
"""
type ProgramServiceConnection {
"Information to aid in pagination."
pageInfo: PageInfo!
"A list of nodes."
nodes: [ProgramService]
"A list of edges."
edges: [ProgramServiceEdge]
}
"""
An edge in a connection of `ProgramService`.
"""
type ProgramServiceEdge {
"The item at the end of the edge."
node: ProgramService!
"A cursor for use in pagination."
cursor: String!
}
"""
Input for `CreateProgramService` mutation.
User must have scope **program_service:write** to perform this action.
"""
input CreateProgramServiceInput {
"Id of service"
serviceId: ID
"Id of service group"
serviceGroupId: ID
"Service program Identifier"
medicalProgramId: ID!
"Whether requesting medications allowed for the `ProgramService` or not?"
requestAllowed: Boolean!
"Consumer price for service or service group"
consumerPrice: Float!
"Description of un-automated conditions which should be checked for program member vs patient qualification"
description: String
}
"""
Return type for `CreateProgramService` mutation.
"""
type CreateProgramServicePayload {
"Created `ProgramService`."
programService: ProgramService
}
"""
Input for `updateProgramService` mutation.
User must have a scope **program_service:write**
"""
input UpdateProgramServiceInput {
"The ID of an object."
id: ID!
"Whether requesting medications allowed for the `ProgramService` or not?"
requestAllowed: Boolean
"Description of un-automated conditions which should be checked for program member vs patient qualification"
description: String
}
"""
Return type for `updateProgramService` mutation.
"""
type UpdateProgramServicePayload {
"Updated `ProgramService`."
programService: ProgramService
}
"""
Input for `deactivateProgramService` mutation.
User must have a scope **program_service:write*
"""
input DeactivateProgramServiceInput {
"The ID of an object"
id: ID!
}
"""
Return type for `deactivateProgramService` mutation.
"""
type DeactivateProgramServicePayload {
"Deactivated `ProgramService`."
programService: ProgramService
}
"""
Program Service connects service, serviceGroup and medical program.
In order to obtain details user must have a scope **program_service:read**
"""
type ProgramService implements Node {
"The ID of an object."
id: ID!
"Primary key identifier from the database."
databaseId: UUID!
"MedicalProgram."
medicalProgram: MedicalProgram!
"Service"
service: Service
"Service group"
serviceGroup: ServiceGroup
"Consumer price for service or service group"
consumerPrice: Float
"Description of un-automated conditions which should be checked for program member vs patient qualification"
description: String
"Whether `ProgramService` is active or not?"
isActive: Boolean!
"Whether requesting services allowed for the `ProgramService` or not?"
requestAllowed: Boolean!
"Date and time when record was inserted"
insertedAt: DateTime!
"Date and time when record was updated"
updatedAt: DateTime!
} |
|
Page Properties |
---|
|
Link | - | Посилання на Apiary або Swagger | Resource | /graphql | Посилання на ресурс, наприклад: /api/persons/create | Scope | program_service:write | Scope для доступу | Components | Program Services | Зазначається перелік бізнес компонентів, які використовують цей метод, наприклад: ePrescription | Microservices | API paragraph not found | Перелік мікросервісів, які використовує метод API, наприклад: Auth, ABAC | Protocol type | GraphQL | Тип протоколу, який використовується запитом, наприклад: SOAP | REST | Request type | POST | Тип запиту API, наприклад: GET, POST, PATCH… | Sync/Async | API paragraph not found | Метод є синхронним чи асинхронним? | Public/Private/Internal | Private | Потрібно зазначити тип методу за ступенем доступності |
|
Preconditions
Before this the program serviсe should be created by NHS
Logic
This WS is designed for NHS employees. To deactivate program service it must be active.
This query is use to deactivate existing program service.
Input parameters
Input parameter | Values | Type | Description | Example |
---|
id | | String | Program service identifier. Required | d290f1ee-6c54-4b01-90e6-d701748f0851 |
Request structure
Example:
Expand |
---|
|
Code Block |
---|
| {
"operationName": "DeactivateProgramServiceMutation",
"variables": {
"input": {
"id": "UHJvZ3JhbVNlcnZpY2U6NGJlNTMzNWItZjJhNy00NTA1LTg0ZDctOTdmMjZlYTIwZWNh"
}
},
"query": "mutation DeactivateProgramServiceMutation($input: DeactivateProgramServiceInput!) { deactivateProgramService(input: $input) { programService { id isActive __typename } __typename } } "
} |
|
Authorize
Verify the validity of access token
in case of error return 401 error “Access denied”
Check user scope program_service:write in order to perform this action
in case of error generate 403 error “Your scope does not allow to access this resource. Missing allowances: program_service:write”
Наприклад:
Content-Type:application/json
Authorization:Bearer c2778f3064753ea70de870a53795f5c9
Request data validation
Validate status
Program service should be active (is_active == TRUE)
Validate `is_active` == FALSE
if invalid - return error "ProgramService is not active"
Validate Program service
Check on existing Program service record
Check
...
existProgram service by $.id.
if invalid - return
...
error "Program service is not found
...
"
...
Validate Service
When deactivate service from program service, check group(in which service include) don't include in this program.
if invalid - return
...
error
...
"Delete this service from service group
...
"
...
...
Processing
...
Update program service record by $.id set values:
...
...
...
id set value “is_active”= false
Response structure
Examples:
Expand |
---|
title | Response example (success) |
---|
|
Code Block |
---|
{
"data": {
"deactivateProgramService": {
"__typename": "DeactivateProgramServicePayload",
"programService": {
"__typename": "ProgramService",
"id": "UHJvZ3JhbVNlcnZpY2U6Nzg0NGFiOGUtNWQzZC00OGNkLWI5MDUtODJjMWEwNWZhZGQw",
"isActive": false
}
}
},
"extensions": {
"requestId": "28b9c0d7-9e94-4099-a646-46d219f1a25a#614"
}
} |
|
Expand |
---|
title | Response example (error) |
---|
|
Code Block |
---|
{
"data": {
"updateProgramService": null
},
"errors": [
{
"extensions": {
"code": "CONFLICT"
},
"locations": [
{
"column": 77,
"line": 1
}
],
"message": "ProgramService is not active",
"path": [
"updateProgramService"
]
}
],
"extensions": {
"requestId": "28b9c0d7-9e94-4099-a646-46d219f1a25a#508"
}
} |
|
Expand |
---|
title | Response example (authorization error) |
---|
|
Code Block |
---|
{
"error": {
"message": "Invalid access token",
"type": "access_denied"
},
"meta": {
"code": 401,
"url": "http://api.dev.edenlab.com.ua:8000/graphql",
"request_id": "931c0790-ddfe-45e5-960a-eb6ba9f24e19#65",
"type": "object"
}
} |
|
Post-processing processes
HTTP status codes
Page Properties |
---|
|
HTTP status code | Message | What caused the error |
---|
200 | Response | | 401 | Access denied | Invalid token | 403 | Your scope does not allow to access this resource. Missing allowances: {{scope}} | Scope is missing |
|