...
...
...
...
...
...
...
...
...
...
...
...
...
...
Schema
Features - add service to group
Features - add service to group
Authorize
- Check user scope (scope = 'service_catalog:write') in order to perform this action
- In case error - generate 401 response
Active connection service with service group
Search active connection service with service group
SELECT
*
FROM
service_inclusions
...
...
Purpose
API paragraph not found
Specification
Page Properties |
---|
|
Link | API paragraph not found | Resource | API paragraph not found | Scope | service_catalog:write | Components | API paragraph not found | Microservices | API paragraph not found | Protocol type | API paragraph not found | Request type | API paragraph not found | Sync/Async | API paragraph not found | Public/Private/Internal | Private |
|
Expand |
---|
|
Code Block |
---|
# import Service from "services.graphql"
"""
Fields to filter service group in the system.
"""
input ServiceGroupFilter {
"Primary key identifier from the database."
databaseId: UUID
"Service group name."
name: String
"Service group code."
code: String
"Flag whether `Service group` is active or not?"
isActive: Boolean
"Applies conditions to object’s `parentGroup` field."
parentGroup: ServiceGroupFilter
}
"""
Methods to use when ordering `ServicesGroup`.
"""
enum ServiceGroupOrderBy {
"Orders by the object’s `code` field in the ascending order."
CODE_ASC
"Orders by the object’s `code` field in the descending order."
CODE_DESC
"Sort ServiceGroup by inserted_at in ascending order."
INSERTED_AT_ASC
"Sort ServiceGroup by inserted_at in descending order."
INSERTED_AT_DESC
"Sort Services by name in ascending order."
NAME_ASC
"Sort Services by name in descending order."
NAME_DESC
}
"""
A connection to a list of `ServiceGroup` items.
"""
type ServiceGroupConnection {
"Information to aid in pagination."
pageInfo: PageInfo!
"A list of nodes."
nodes: [ServiceGroup]
"A list of edges."
edges: [ServiceGroupEdge]
}
"""
An edge in a connection of `ServiceGroup`.
"""
type ServiceGroupEdge {
"The item at the end of the edge."
node: ServiceGroup!
"A cursor for use in pagination."
cursor: String!
}
"""
Input for `createServiceGroup` mutation.
User must have scopes **service_catalog:write**
"""
input CreateServiceGroupInput {
"Service group name"
name: String!
"Service group code"
code: String!
"Whether requesting service groups allowed for the `ServiceGroup` or not?"
requestAllowed: Boolean!
"Id of connected service group."
parentGroupId: ID
}
"""
Return type for `createServiceGroup` mutation.
"""
type CreateServiceGroupPayload {
"Created `Service Group`."
serviceGroup: ServiceGroup
}
"""
Input for `deactivateServiceGroup` mutation.
User must have scopes **service_catalog:write**
"""
input DeactivateServiceGroupInput {
"The ID of an object"
id: ID!
}
"""
Return type for `deactivateServiceGroup` mutation.
"""
type DeactivateServiceGroupPayload {
"Deactivated `ServiceGroup`."
serviceGroup: ServiceGroup
}
"""
Input for `addServiceToGroup` mutation.
User must have scopes **service_catalog:write**
"""
input AddServiceToGroupInput {
"Service Id"
serviceId: ID!
"Service group Id"
serviceGroupId: ID!
}
"""
Return type for `addServiceToGroup` mutation.
"""
type AddServiceToGroupPayload {
"Updated `Service Group`."
serviceGroup: ServiceGroup
}
"""
Input for `updateServiceGroup` mutation.
User must have scopes **service_catalog:write**
"""
input UpdateServiceGroupInput {
"The ID of an object"
id: ID!
"Whether requesting allowed for the `ServiceGroup` or not?"
requestAllowed: Boolean
}
"""
Return type for `updateServiceGroup` mutation.
"""
type UpdateServiceGroupPayload {
"Update `ServiceGroup`."
serviceGroup: ServiceGroup
}
"""
Input for `deleteServiceFromGroup` mutation.
User must have scopes **service_catalog:write**
"""
input DeleteServiceFromGroupInput {
"Service Id"
serviceId: ID!
"Service group Id"
serviceGroupId: ID!
}
"""
Return type for `deleteServiceFromGroup` mutation.
"""
type DeleteServiceFromGroupPayload {
"Updated `Service Group`."
serviceGroup: ServiceGroup
}
"""
Service group that provided by legal entity. User must have a scope **service_catalog:read**
"""
type ServiceGroup implements Node {
"The ID of an object"
id: ID!
"Primary key identifier from the database"
databaseId: UUID!
"Service group name"
name: String!
"Service group code"
code: String!
"Whether the `ServiceGroup` is active or not?"
isActive: Boolean!
"Parent service group"
parentGroup: ServiceGroup
"Reads through a set of associated `ServiceGroup`."
subGroups(
"A condition to be used in determining which values should be returned by the collection."
filter: ServiceGroupFilter
"The method to use when ordering collection items."
orderBy: ServiceGroupOrderBy
"Read all values in the set after (below) this cursor."
after: String
"Read all values in the set before (above) this cursor."
before: String
"Only read the first _n_ values of the set."
first: Int
"Only read the last _n_ values of the set."
last: Int
): ServiceGroupConnection!
"Whether requesting service groups allowed for the `ServiceGroup` or not?"
requestAllowed: Boolean!
"Reads through a set of associated `ServiceGroup`."
services(
"A condition to be used in determining which values should be returned by the collection."
filter: ServiceFilter
"The method to use when ordering collection items."
orderBy: ServiceOrderBy
"Read all values in the set after (below) this cursor."
after: String
"Read all values in the set before (above) this cursor."
before: String
"Only read the first _n_ values of the set."
first: Int
"Only read the last _n_ values of the set."
last: Int
): ServiceConnection!
"Date and time when record was inserted"
insertedAt: DateTime!
"Date and time when record was updated"
updatedAt: DateTime!
} |
|
|
Expand |
---|
title | Features - add service to group |
---|
|
Code Block |
---|
Feature: Add service to group
Scenario: Successful service addition to service group
Given the following service groups exist:
| databaseId |
| "fdb745ec-7d48-41dc-bf72-5882cee6d3ea" |
And the following services exist:
| databaseId |
| "a9e2873e-1290-496a-a078-7106c32f1130" |
And my scope is "service_catalog:write"
And my client type is "NHS"
And my consumer ID is "8341b7d6-f9c7-472a-960c-7da953cc4ea4"
When I add service to group with attributes:
| serviceId | serviceGroupId |
| "U2VydmljZTphOWUyODczZS0xMjkwLTQ5NmEtYTA3OC03MTA2YzMyZjExMzA=" | "U2VydmljZUdyb3VwOmZkYjc0NWVjLTdkNDgtNDFkYy1iZjcyLTU4ODJjZWU2ZDNlYQ==" |
Then no errors should be returned
And request id should be returned
And the databaseId of the requested item should be "fdb745ec-7d48-41dc-bf72-5882cee6d3ea"
And nodes in the services of the requested item should include the item with the following fields:
| field | value |
| databaseId | "a9e2873e-1290-496a-a078-7106c32f1130" |
Scenario: Successful service addition to service group when both included in program service
Given the following medical programs exist:
| databaseId | type |
| "3b57cbdb-9a72-4326-a556-a4b9630aa64d" | "SERVICE" |
And the following service groups exist:
| databaseId | name | code |
| "fdb745ec-7d48-41dc-bf72-5882cee6d3ea" | "Функціональні тести серця " | "2HF" |
And the following program services exist:
| serviceGroupId | medicalProgramId | requestAllowed |
| "fdb745ec-7d48-41dc-bf72-5882cee6d3ea" | "3b57cbdb-9a72-4326-a556-a4b9630aa64d" | true |
And the following services exist:
| databaseId | name |
| "a9a0383e-61d3-4b43-8dc0-d694e37c8912" | "Фонокардіографія" |
And the following program services exist:
| serviceId | medicalProgramId | requestAllowed |
| "a9a0383e-61d3-4b43-8dc0-d694e37c8912" | "3b57cbdb-9a72-4326-a556-a4b9630aa64d" | true |
And my scope is "service_catalog:write"
And my client type is "NHS"
And my consumer ID is "8341b7d6-f9c7-472a-960c-7da953cc4ea4"
When I add service to group with attributes:
| serviceId | serviceGroupId |
| "U2VydmljZTphOWEwMzgzZS02MWQzLTRiNDMtOGRjMC1kNjk0ZTM3Yzg5MTI=" | "U2VydmljZUdyb3VwOmZkYjc0NWVjLTdkNDgtNDFkYy1iZjcyLTU4ODJjZWU2ZDNlYQ==" |
Then no errors should be returned
And request id should be returned
And the databaseId of the requested item should be "fdb745ec-7d48-41dc-bf72-5882cee6d3ea"
And nodes in the services of the requested item should include the item with the following fields:
| field | value |
| databaseId | "a9a0383e-61d3-4b43-8dc0-d694e37c8912" |
Scenario: Successful service addition to service group when service included in program service
Given the following medical programs exist:
| databaseId | type |
| "3b57cbdb-9a72-4326-a556-a4b9630aa64d" | "SERVICE" |
And the following service groups exist:
| databaseId | name | code |
| "fdb745ec-7d48-41dc-bf72-5882cee6d3ea" | "Функціональні тести серця " | "2HF" |
And the following service exist:
| databaseId | name |
| "a9a0383e-61d3-4b43-8dc0-d694e37c8912" | "Фонокардіографія" |
And the following program services exist:
| serviceId | medicalProgramId | requestAllowed |
| "a9a0383e-61d3-4b43-8dc0-d694e37c8912" | "3b57cbdb-9a72-4326-a556-a4b9630aa64d" | true |
And my scope is "service_catalog:write"
And my client type is "NHS"
And my consumer ID is "8341b7d6-f9c7-472a-960c-7da953cc4ea4"
When I add service to group with attributes:
| serviceId | serviceGroupId |
| "U2VydmljZTphOWEwMzgzZS02MWQzLTRiNDMtOGRjMC1kNjk0ZTM3Yzg5MTI=" | "U2VydmljZUdyb3VwOmZkYjc0NWVjLTdkNDgtNDFkYy1iZjcyLTU4ODJjZWU2ZDNlYQ==" |
Then no errors should be returned
And request id should be returned
And the databaseId of the requested item should be "fdb745ec-7d48-41dc-bf72-5882cee6d3ea"
And nodes in the services of the requested item should include the item with the following fields:
| field | value |
| databaseId | "a9a0383e-61d3-4b43-8dc0-d694e37c8912" |
Scenario: Add service to group with incorrect scope
Given the following service groups exist:
| databaseId |
| "fdb745ec-7d48-41dc-bf72-5882cee6d3ea" |
And the following services exist:
| databaseId |
| "a9e2873e-1290-496a-a078-7106c32f1130" |
And my scope is "service_catalog:read"
And my consumer ID is "04796283-74b8-4632-9f7f-9e227ae9426e"
When I add service to group with attributes:
| serviceId | serviceGroupId |
| "U2VydmljZTphOWUyODczZS0xMjkwLTQ5NmEtYTA3OC03MTA2YzMyZjExMzA=" | "U2VydmljZUdyb3VwOmZkYjc0NWVjLTdkNDgtNDFkYy1iZjcyLTU4ODJjZWU2ZDNlYQ==" |
Then the "FORBIDDEN" error should be returned
And request id should be returned
And I should not receive requested item
Scenario: Create with incorrect client
Given the following service groups exist:
| databaseId |
| "fdb745ec-7d48-41dc-bf72-5882cee6d3ea" |
And the following services exist:
| databaseId |
| "a9e2873e-1290-496a-a078-7106c32f1130" |
And my scope is "service_catalog:write"
And my client type is "MSP"
And my consumer ID is "089c0204-a191-4537-ab92-56dca268443c"
When I add service to group with attributes:
| serviceId | serviceGroupId |
| "U2VydmljZTphOWUyODczZS0xMjkwLTQ5NmEtYTA3OC03MTA2YzMyZjExMzA=" | "U2VydmljZUdyb3VwOmZkYjc0NWVjLTdkNDgtNDFkYy1iZjcyLTU4ODJjZWU2ZDNlYQ==" |
Then the "FORBIDDEN" error should be returned
And request id should be returned
And I should not receive requested item
Scenario Outline: Add with non-existent service or service group
Given the following <existing_entity> exist:
| databaseId |
| <existing_database_id> |
And my scope is "service_catalog:write"
And my client type is "NHS"
And my consumer ID is "46d29f1b-122c-40ae-a36b-be138fb9c987"
When I add service to group with attributes:
| <existing_attr> | <non_existing_attr> |
| <existing_id> | <non_existing_id> |
Then the "NOT_FOUND" error should be returned
And I should not receive requested item
Examples:
| existing_entity | existing_attr | non_existing_attr | existing_database_id | existing_id | non_existing_id |
| service group | serviceGroupId | serviceId | "fdb745ec-7d48-41dc-bf72-5882cee6d3ea" | "U2VydmljZUdyb3VwOmZkYjc0NWVjLTdkNDgtNDFkYy1iZjcyLTU4ODJjZWU2ZDNlYQ==" | "U2VydmljZTphOWUyODczZS0xMjkwLTQ5NmEtYTA3OC03MTA2YzMyZjExMzA=" |
| service | serviceId | serviceGroupId | "a9e2873e-1290-496a-a078-7106c32f1130" | "U2VydmljZTphOWUyODczZS0xMjkwLTQ5NmEtYTA3OC03MTA2YzMyZjExMzA=" | "U2VydmljZUdyb3VwOmZkYjc0NWVjLTdkNDgtNDFkYy1iZjcyLTU4ODJjZWU2ZDNlYQ==" |
Scenario Outline: Add with deactivated service or service group
Given the following <active_entity> exist:
| databaseId | isActive |
| <active_database_id> | true |
And the following <inactive_entity> exist:
| databaseId | isActive |
| <inactive_database_id> | false |
And my scope is "service_catalog:write"
And my client type is "NHS"
And my consumer ID is "c3aeae43-985b-4412-b8ff-15ddee5a47de"
When I add service to group with attributes:
| <active_attr> | <inactive_attr> |
| <active_id> | <inactive_id> |
Then the "CONFLICT" error should be returned
And I should not receive requested item
Examples:
| active_entity | inactive_entity | active_attr | inactive_attr | active_database_id | inactive_database_id | active_id | inactive_id |
| service group | service | serviceGroupId | serviceId | "fdb745ec-7d48-41dc-bf72-5882cee6d3ea" | "a9e2873e-1290-496a-a078-7106c32f1130" | "U2VydmljZUdyb3VwOmZkYjc0NWVjLTdkNDgtNDFkYy1iZjcyLTU4ODJjZWU2ZDNlYQ==" | "U2VydmljZTphOWUyODczZS0xMjkwLTQ5NmEtYTA3OC03MTA2YzMyZjExMzA=" |
| service | service group | serviceId | serviceGroupId | "a9e2873e-1290-496a-a078-7106c32f1130" | "fdb745ec-7d48-41dc-bf72-5882cee6d3ea" | "U2VydmljZTphOWUyODczZS0xMjkwLTQ5NmEtYTA3OC03MTA2YzMyZjExMzA=" | "U2VydmljZUdyb3VwOmZkYjc0NWVjLTdkNDgtNDFkYy1iZjcyLTU4ODJjZWU2ZDNlYQ==" |
Scenario: Add already added service to group
Given the following service groups exist:
| databaseId |
| "fdb745ec-7d48-41dc-bf72-5882cee6d3ea" |
And the following services exist:
| databaseId |
| "a9e2873e-1290-496a-a078-7106c32f1130" |
And the following service inclusions exist:
| serviceId | serviceGroupId | isActive |
| "a9e2873e-1290-496a-a078-7106c32f1130" | "fdb745ec-7d48-41dc-bf72-5882cee6d3ea" | true |
And my scope is "service_catalog:write"
And my client type is "NHS"
And my consumer ID is "8341b7d6-f9c7-472a-960c-7da953cc4ea4"
When I add service to group with attributes:
| serviceId | serviceGroupId |
| "U2VydmljZTphOWUyODczZS0xMjkwLTQ5NmEtYTA3OC03MTA2YzMyZjExMzA=" | "U2VydmljZUdyb3VwOmZkYjc0NWVjLTdkNDgtNDFkYy1iZjcyLTU4ODJjZWU2ZDNlYQ==" |
Then the "CONFLICT" error should be returned
And I should not receive requested item
Scenario: Add service to service group having sub groups
Given the following service groups exist:
| databaseId | name | code |
| "fdb745ec-7d48-41dc-bf72-5882cee6d3ea" | "Функціональні" | "2H" |
And the following service groups exist:
| databaseId | name | code | parentGroupId |
| "b05c7105-8032-4b4d-ac5c-03bd57947978" | "Функціональні тести серця " | "2HF" | "fdb745ec-7d48-41dc-bf72-5882cee6d3ea" |
And the following services exist:
| databaseId |
| "a9a0383e-61d3-4b43-8dc0-d694e37c8912" |
And my scope is "service_catalog:write"
And my client type is "NHS"
And my consumer ID is "8341b7d6-f9c7-472a-960c-7da953cc4ea4"
When I add service to group with attributes:
| serviceId | serviceGroupId |
| "U2VydmljZTphOWEwMzgzZS02MWQzLTRiNDMtOGRjMC1kNjk0ZTM3Yzg5MTI=" | "U2VydmljZUdyb3VwOmZkYjc0NWVjLTdkNDgtNDFkYy1iZjcyLTU4ODJjZWU2ZDNlYQ==" |
Then the "CONFLICT" error should be returned
And I should not receive requested item
Scenario: Add service to service group when service is not included in medical program which service group included in
Given the following medical programs exist:
| databaseId | type |
| "3b57cbdb-9a72-4326-a556-a4b9630aa64d" | "SERVICE" |
And the following service groups exist:
| databaseId | name | code |
| "fdb745ec-7d48-41dc-bf72-5882cee6d3ea" | "Функціональні тести серця " | "2HF" |
And the following services exist:
| databaseId | name |
| "a9a0383e-61d3-4b43-8dc0-d694e37c8912" | "Фонокардіографія" |
And the following program services exist:
| serviceGroupId | medicalProgramId | requestAllowed |
| "fdb745ec-7d48-41dc-bf72-5882cee6d3ea" | "3b57cbdb-9a72-4326-a556-a4b9630aa64d" | true |
And my scope is "service_catalog:write"
And my client type is "NHS"
And my consumer ID is "8341b7d6-f9c7-472a-960c-7da953cc4ea4"
When I add service to group with attributes:
| serviceId | serviceGroupId |
| "U2VydmljZTphOWEwMzgzZS02MWQzLTRiNDMtOGRjMC1kNjk0ZTM3Yzg5MTI=" | "U2VydmljZUdyb3VwOmZkYjc0NWVjLTdkNDgtNDFkYy1iZjcyLTU4ODJjZWU2ZDNlYQ==" |
Then the "CONFLICT" error should be returned
And I should not receive requested item |
|
|
Logic
When service add to service group - create new record in table Service_inclusions
When delete service from service group - search connection service with service group and set is_active
= False
Request structure
API paragraph not found
Authorize
Check user scope (scope = 'service_catalog:write') in order to perform this action
In case error - generate 401 response
Headers
API paragraph not found
Request data validation
Validate status
When add service to service group check that Service/Service group should be active (is_active == TRUE)
Validate `is_active` == FALSE
if invalid - return 409 eror (message: "Service/Service group should be active !")
Validate PK Service/Service group
Check on existing Service/Service group record
Check exist Service/Service group by $.id.
if invalid - return 404 error (message: "Service/Service group is not found!")
Validate uniqueness active connection Service with Service group
Active connection service with service group. In case of duplication the error must be shown.
Check uniqueness by $.service_id and $.service_group_id and $.service_inclusions.is_active = True
if invalid - return 409 error (message: "Service already added in service group")
Validate Service Group
When add service to group, check Service group don't have active subroup:
if invalid - return 422 error (message: "ServiceGroup should not have active subgroups")
Validate Program service
When add service to group and this Service group included in program service, check that Service included in this program service
if invalid - return 422 error (message: "Service should be included in all medical programs which ServiceGroup included in")
When deactivate service from program service, check that Service group (in which service included) don't included in this program service
if invalid - return 422 error (message: "Service should be removed from ServiceGroup which included in this medical program")
Processing
Active connection service with service group
Search active connection service with service group
SELECT * FROM service_inclusions
WHERE is_active = True
|
Response structure
API paragraph not found
Post-processing processes
API paragraph not found
HTTP status codes
API paragraph not found