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

(GraphQL) Create Service group

Purpose

API paragraph not found

 

Specification

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

# 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! }

 

Feature: Create service group Scenario: Successful creation Given my scope is "service_catalog:write" And my client type is "NHS" And my consumer ID is "1ad3c0e6-e2fc-2d3c-a15c-5101874165a7" When I create service group with attributes: | name | code | | "Ультразвукові дослідження в неврології" | "2FA" | Then no errors should be returned And request id should be returned And I should receive requested item And the name of the requested item should be "Ультразвукові дослідження в неврології" Scenario: Successful creation with parent group Given the following service groups exist: | databaseId | requestAllowed | | "f4ce3fdf-d49b-426c-9636-8b186db75d73" | false | And my scope is "service_catalog:write" And my client type is "NHS" And my consumer ID is "1ad3c0e6-e2fc-2d3c-a15c-5101874165a7" When I create service group with attributes: | name | code | parentGroupId | | "Ультразвукові дослідження в неврології" | "2FA" | "U2VydmljZUdyb3VwOmY0Y2UzZmRmLWQ0OWItNDI2Yy05NjM2LThiMTg2ZGI3NWQ3Mw==" | Then no errors should be returned And request id should be returned And I should receive requested item And the databaseId in parentGroup of the requested item should be "f4ce3fdf-d49b-426c-9636-8b186db75d73" Scenario: Successful creation with deactivated existing code Given the following service groups exist: | code | isActive | | "2FA" | false | And my scope is "service_catalog:write" And my client type is "NHS" And my consumer ID is "1ad3c0e6-e2fc-2d3c-a15c-5101874165a7" When I create service group with attributes: | name | code | | "Ультразвукові дослідження в неврології" | "2FA" | Then no errors should be returned And request id should be returned And I should receive requested item And the code of the requested item should be "2FA" Scenario: Create with incorrect scope Given my scope is "service_catalog:read" And my consumer ID is "04796283-74b8-4632-9f7f-9e227ae9426e" When I create service group with attributes: | name | code | | "Ультразвукові дослідження в неврології" | "2FA" | 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 my scope is "service_catalog:write" And my client type is "MSP" And my consumer ID is "089c0204-a191-4537-ab92-56dca268443c" When I create service group with attributes: | name | code | | "Ультразвукові дослідження в неврології" | "2FA" | Then the "FORBIDDEN" error should be returned And request id should be returned And I should not receive requested item Scenario Outline: Create with invalid params Given my scope is "service_catalog:write" And my client type is "NHS" And my consumer ID is "94e4301f-2d28-4403-b59f-b5865e9ca26f" When I create service group with attributes: | name | code | | <name> | <code> | Then the "UNPROCESSABLE_ENTITY" error should be returned And request id should be returned And I should not receive requested item Examples: | name | code | | "" | "2FA" | | "Діагностичні інструментальні" | "" | Scenario: Create with already existing code Given the following service groups exist: | code | isActive | | "2FA" | true | And my scope is "service_catalog:write" And my client type is "NHS" And my consumer ID is "1ad3c0e6-e2fc-2d3c-a15c-5101874165a7" When I create service group with attributes: | name | code | | "Ультразвукові дослідження в неврології" | "2FA" | Then the "UNPROCESSABLE_ENTITY" error should be returned And request id should be returned And I should not receive requested item Scenario: Create with parent group allowed to request Given the following service groups exist: | databaseId | requestAllowed | | "f4ce3fdf-d49b-426c-9636-8b186db75d73" | true | And my scope is "service_catalog:write" And my client type is "NHS" And my consumer ID is "1ad3c0e6-e2fc-2d3c-a15c-5101874165a7" When I create service group with attributes: | name | code | parentGroupId | | "Ультразвукові дослідження в неврології" | "2FA" | "U2VydmljZUdyb3VwOmY0Y2UzZmRmLWQ0OWItNDI2Yy05NjM2LThiMTg2ZGI3NWQ3Mw==" | Then the "CONFLICT" error should be returned And request id should be returned And I should not receive requested item

 

 

Filters 

Input parameter

Values

Type

Description

Example

Input parameter

Values

Type

Description

Example

name

 

 

 

 

code

 

 

 

 

requestAllowed

 

 

 

 

parentGroup

 

 

 

 

 

Request structure

API paragraph not found

 

Authorize

  1. Verify the validity of access token

  2. Check user scope (scope = 'service_catalog:write') in order to perform this action

    1. In case error - generate 401 response

 

Headers

API paragraph not found

 

Request data validation

Validate code

  1. Check that all elements in array of code are different  where service_groups.is_active = True.

    1. in case of error return 422 error (message `codes are duplicated`)

Validate parent Group

Check on existing parentGroup in Service Groups. 

  1. Check exist `Service Groups` by $.service_group[].id.

    1. if invalid - return 422 error (message: "parent Group in Service Group not found")

Parent Group's in service group must be active  

  1. Search `Service Groups` ($.service_group[].id). Check exist any service_group.is_active=FALSE.

    1. if exists - return 422 error (message: "Service Group is not active")

Parent Group must have requestAllowed = False

  1. Search `Service Groups` ($.service_group[].id). Check exist service_group.request_allowed=TRUE.

    1. if exists - return 422 error (message: "Parent ServiceGroup should not be allowed to request")

 

Processing

Create new Service Group

  1. Create new record in Service_groups

  2. Fill data 

Name

Source

Name

Source

id

 

code

$.code

name

$.name

is_active

True

parent_group_id

$.parent_group_id

request_allowed

$.request_allowed

inserted_at

:timestamp

inserted_by

user_id

updated_at

:timestamp

updated_by

user_id

 

Response structure

API paragraph not found

 

Post-processing processes

API paragraph not found

 

HTTP status codes

API paragraph not found

 

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