# 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!
}
Features
Feature: Deactivate service
Scenario: Successful deactivation
Given the following services exist:
| databaseId | isActive |
| "f17f96f5-d5be-4270-8940-a3fe0ddbcd7b" | true |
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 deactivate service where databaseId is "f17f96f5-d5be-4270-8940-a3fe0ddbcd7b"
Then no errors should be returned
And I should receive requested item
And the isActive of the requested item should be false
Scenario: Successful deactivate when active service group exist
Given the following services exist:
| databaseId | isActive |
| "f17f96f5-d5be-4270-8940-a3fe021aba14" | true |
And the following service group exist:
| databaseId | isActive |
| "ab1bad75-4ed2-4f5b-a695-a3fe0ddbcd7b" | true |
And the following service inclusions exist:
| serviceId | serviceGroupId |
| "f17f96f5-d5be-4270-8940-a3fe021aba14" | "ab1bad75-4ed2-4f5b-a695-a3fe0ddbcd7b" |
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 deactivate service where databaseId is "f17f96f5-d5be-4270-8940-a3fe021aba14"
And I should receive requested item
And the isActive of the requested item should be false
Scenario: Deactivate with incorrect scope
Given the following services exist:
| databaseId | isActive |
| "e6516e2e-aa11-4ed2-881f-9b0aa2ec9f66" | true |
And my scope is "service_catalog:read"
And my consumer ID is "46d29f1b-122c-40ae-a36b-be138fb9c987"
When I deactivate service where databaseId is "e6516e2e-aa11-4ed2-881f-9b0aa2ec9f66"
Then the "FORBIDDEN" error should be returned
And I should not receive requested item
Scenario: Deactivate with incorrect client
Given the following services exist:
| databaseId | isActive |
| "d41aa795-bfd6-4e87-be04-b2864d7fdc44" | true |
And my scope is "service_catalog:write"
And my client type is "MIS"
And my consumer ID is "46d29f1b-122c-40ae-a36b-be138fb9c987"
When I deactivate service where databaseId is "d41aa795-bfd6-4e87-be04-b2864d7fdc44"
Then the "FORBIDDEN" error should be returned
And I should not receive requested item
Scenario: Deactivate non-existent item
Given my scope is "service_catalog:write"
And my client type is "NHS"
And my consumer ID is "46d29f1b-122c-40ae-a36b-be138fb9c987"
When I deactivate service where databaseId is "2abef13c-7b4c-4c83-876f-a269ff816915"
Then the "NOT_FOUND" error should be returned
And I should not receive requested item
Scenario: Deactivate already deactivated service
Given the following services exist:
| databaseId | isActive |
| "ccfb1492-0f12-4365-bb6f-50939ef25319" | false |
And my scope is "service_catalog:write"
And my client type is "NHS"
And my client ID is "a1edf3a8-646c-2afa-f21d-2d52229f6f1f"
And my consumer ID is "c3aeae43-985b-4412-b8ff-15ddee5a47de"
When I deactivate service where databaseId is "ccfb1492-0f12-4365-bb6f-50939ef25319"
Then the "CONFLICT" error should be returned
And I should not receive requested item
Logic
API paragraph not found
Input parameters
Input parameter
Values
Type
Description
Example
Input parameter
Values
Type
Description
Example
id
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 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 Service Group subgroup
When deactivate service group, check Service group don't have active subroup:
if invalid - return 422 error (message: "ServiceGroup should not have active subgroups")
Processing
Update Service/Service group
Update Service/Service group record by $.id set values: