- Created by Aleksandra Novokhatnia, last modified by Dmytro Kulibaba on Sep 28, 2022
You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 5 Next »
Specification
Schema
""" Fields to filter service in the system. """ input ServiceFilter { "Primary key identifier from the database." databaseId: UUID "Service name." name: String "Service code." code: String "Flag whether `Service` is active or not?" isActive: Boolean "Service category. The value should be present in the `SERVICE_CATEGORY` dictionary." category: String } """ Methods to use when ordering `Services`. """ enum ServiceOrderBy { "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 Service by inserted_at in ascending order." INSERTED_AT_ASC "Sort Service 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 `Service` items. """ type ServiceConnection { "Information to aid in pagination." pageInfo: PageInfo! "A list of nodes." nodes: [Service] "A list of edges." edges: [ServiceEdge] } """ An edge in a connection of `Service`. """ type ServiceEdge { "The item at the end of the edge." node: Service! "A cursor for use in pagination." cursor: String! } """ Input for `createService` mutation. User must have scopes **service_catalog:write** """ input CreateServiceInput { "Service name" name: String! "Service code" code: String! "Service category. The value should be present in the `SERVICE_CATEGORY` dictionary." category: String "Service isComposition flag" isComposition: Boolean "Service requestAllowed flag" requestAllowed: Boolean } """ Return type for `createService` mutation. """ type CreateServicePayload { "Created `Service`." service: Service } """ Input for `updateService` mutation. User must have scopes **service_catalog:write** """ input UpdateServiceInput { "The ID of an object" id: ID! "Whether requesting allowed for the `Service` or not?" requestAllowed: Boolean } """ Return type for `updateService` mutation. """ type UpdateServicePayload { "Update `Service`." service: Service } """ Input for `deactivateService` mutation. User must have scopes **service_catalog:write** """ input DeactivateServiceInput { "The ID of an object" id: ID! } """ Return type for `deactivateService` mutation. """ type DeactivateServicePayload { "Deactivated `Service`." service: Service } """ Services that provided by legal entity. User must have a scope **service_catalog:read** """ type Service implements Node { "The ID of an object" id: ID! "Primary key identifier from the database" databaseId: UUID! "Service name" name: String! "Service code" code: String! "Service category. The value should be present in the `SERVICE_CATEGORY` dictionary." category: String "Whether `Service` is active or not?" isActive: Boolean! "Whether requesting services allowed for the `Service` or not?" requestAllowed: Boolean "Whether the `Service` is composion or not?" isComposition: Boolean "Reads and enables pagination through a set of parent `ServiceGroup`." serviceGroups( "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! "Date and time when record was inserted" insertedAt: DateTime! "Date and time when record was updated" updatedAt: DateTime! } |
# 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: Update service Scenario Outline: Successful update Given the following services exist: | databaseId | requestAllowed | | <database_id> | <request_allowed> | 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 update the <field> with <next_value> in the service where databaseId is <database_id> Then no errors should be returned And I should receive requested item And the <field> of the requested item should be <next_value> Examples: | database_id | field | next_value | request_allowed | | "3b1a0ad5-7cc4-4e3d-900f-dbff37cdc601" | requestAllowed | false | true | | "b5324d08-5d4b-4b54-9a4a-5d15f30877c1" | requestAllowed | true | false | Scenario: Update with incorrect scope Given the following services exist: | databaseId | requestAllowed | | "a6516e2e-aa11-4ed2-881f-9b0aa2ec9f11" | false | And my scope is "service_catalog:read" And my consumer ID is "46d29f1b-122c-40ae-a36b-be138fb9c987" When I update the requestAllowed with true in the service where databaseId is "a6516e2e-aa11-4ed2-881f-9b0aa2ec9f11" Then the "FORBIDDEN" error should be returned And I should not receive requested item Scenario: Update with incorrect client Given the following services exist: | databaseId | requestAllowed | | "d12ba795-bfd6-3f87-ae04-b2864d7fdca1" | false | 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 update the requestAllowed with true in the service where databaseId is "d12ba795-bfd6-3f87-ae04-b2864d7fdca1" Then the "FORBIDDEN" error should be returned And I should not receive requested item Scenario: Update 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 update the requestAllowed with true in the service where databaseId is "a41ba795-ffd6-af87-1e04-f2864d7fdc22" Then the "NOT_FOUND" error should be returned And I should not receive requested item Scenario: Update inactive item Given the following services exist: | databaseId | isActive | requestAllowed | | "a41ba795-ffd6-af87-1e04-f2864d7fdc22" | false | 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 update the requestAllowed with false in the service where databaseId is "a41ba795-ffd6-af87-1e04-f2864d7fdc22" Then the "CONFLICT" error should be returned And I should not receive requested item |
Feature: Update service group Scenario Outline: Successful update Given the following service groups exist: | databaseId | requestAllowed | | <database_id> | <request_allowed> | And my scope is "service_catalog:write" And my client type is "NHS" And my consumer ID is "e2c24b94-beb6-4522-b3a9-9eb4f0b42d9e" When I update the <field> with <next_value> in the service group where databaseId is <database_id> Then no errors should be returned And I should receive requested item And the <field> of the requested item should be <next_value> Examples: | database_id | field | next_value | request_allowed | | "2c14b0cf-00cb-4807-ada0-e73ad13f0d8a" | requestAllowed | false | true | | "fd4318ea-f90a-485c-ad63-897ee769d089" | requestAllowed | true | false | Scenario: Update with incorrect scope Given the following service groups exist: | databaseId | requestAllowed | | "035d637f-ec30-4a3d-89ac-d0f53fb67f9a" | false | And my scope is "service_catalog:read" And my consumer ID is "e2c24b94-beb6-4522-b3a9-9eb4f0b42d9e" When I update the requestAllowed with true in the service group where databaseId is "035d637f-ec30-4a3d-89ac-d0f53fb67f9a" Then the "FORBIDDEN" error should be returned And I should not receive requested item Scenario: Update with incorrect client Given the following service groups exist: | databaseId | requestAllowed | | "035d637f-ec30-4a3d-89ac-d0f53fb67f9a" | false | And my scope is "service_catalog:write" And my client type is "MIS" And my consumer ID is "e2c24b94-beb6-4522-b3a9-9eb4f0b42d9e" When I update the requestAllowed with true in the service group where databaseId is "035d637f-ec30-4a3d-89ac-d0f53fb67f9a" Then the "FORBIDDEN" error should be returned And I should not receive requested item Scenario: Update non-existent item Given my scope is "service_catalog:write" And my client type is "NHS" And my consumer ID is "e2c24b94-beb6-4522-b3a9-9eb4f0b42d9e" When I update the requestAllowed with true in the service group where databaseId is "035d637f-ec30-4a3d-89ac-d0f53fb67f9a" Then the "NOT_FOUND" error should be returned And I should not receive requested item Scenario: Update inactive item Given the following service groups exist: | databaseId | isActive | requestAllowed | | "035d637f-ec30-4a3d-89ac-d0f53fb67f9a" | false | true | And my scope is "service_catalog:write" And my client type is "NHS" And my consumer ID is "e2c24b94-beb6-4522-b3a9-9eb4f0b42d9e" When I update the requestAllowed with false in the service group where databaseId is "035d637f-ec30-4a3d-89ac-d0f53fb67f9a" Then the "CONFLICT" error should be returned And I should not receive requested item |
Input parameters
id
requestAllowed
Authorize
Verify the validity of access token
Check user scope (scope = 'service_catalog:write) in order to perform this action
In case error - generate 401 response
Validate status
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!")
Update service/service group
Update service/service group requestAllowed
values:
Destination | Source |
---|---|
requestAllowed | FALSE |
updated_at | :timestamp |
updated_by | user_id |
- No labels