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

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Specification

 Schema
# 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 - Get all
Feature: Get all service groups

  Scenario: Request all items
    Given there are 2 service groups exist
    And my scope is "service_catalog:read"
    And my client type is "NHS"
    When I request first 10 service groups
    Then no errors should be returned
    And I should receive collection with 2 items

  Scenario Outline: Request items filtered by condition
    Given the following service groups exist:
      | <field>           |
      | <alternate_value> |
      | <expected_value>  |
    And my scope is "service_catalog:read"
    And my client type is "NHS"
    When I request first 10 service groups where <field> is <filter_value>
    Then no errors should be returned
    And I should receive collection with 1 item
    And the <field> of the first item in the collection should be <expected_value>

    Examples:
      | field      | filter_value                           | expected_value                           | alternate_value                        |
      | databaseId | "2fded273-ee70-4b1a-a64e-bef6eaee2c4e" | "2fded273-ee70-4b1a-a64e-bef6eaee2c4e"   | "6b31e3af-9c24-4991-9ef3-dbec0494e589" |
      | name       | "Ультразвукові дослідження"            | "Ультразвукові дослідження в неврології" | "Загальне обстеження хворого"          |
      | code       | "2"                                    | "2F"                                     | "1AA"                                  |
      | isActive   | true                                   | true                                     | false                                  |

  Scenario Outline: Request items filtered by condition on association
    Given the following <association_entity> exist:
      | <field>           |
      | <alternate_value> |
      | <expected_value>  |
    And the following service groups are associated with <association_entity> accordingly:
      | databaseId     |
      | <alternate_id> |
      | <expected_id>  |
    And my scope is "service_catalog:read"
    And my client type is "NHS"
    When I request first 10 service groups where <field> of the associated <association_field> is <filter_value>
    Then no errors should be returned
    And I should receive collection with 1 item
    And the databaseId of the first item in the collection should be <expected_id>

    Examples:
      | association_entity | association_field | field      | filter_value                           | expected_value                           | alternate_value                        | expected_id                            | alternate_id                           |
      | service groups     | parentGroup       | databaseId | "62c68767-5a4d-49a6-85fd-fefee9fdf32a" | "62c68767-5a4d-49a6-85fd-fefee9fdf32a"   | "c9a8c27f-f179-452c-9beb-c41cef556133" | "e549e93d-e43b-41fc-9493-43c2645c2328" | "20de3ffe-90e7-4997-8ce4-9bb6ffa70b61" |
      | service groups     | parentGroup       | name       | "Ультразвукові дослідження"            | "Ультразвукові дослідження в неврології" | "Загальне обстеження хворого"          | "7a7b112d-b77a-4702-9a71-54ded36ae0ee" | "1ed500d3-35f0-4e85-b58b-a1aef15e94fa" |
      | service groups     | parentGroup       | code       | "2F"                                   | "2FA"                                    | "1AA"                                  | "d4686ebb-63c3-4567-bea0-2faead7023d9" | "5584f70a-d483-402b-8c2f-a5f4624b77cc" |
      | service groups     | parentGroup       | isActive   | true                                   | true                                     | false                                  | "001bb9ec-7f55-4834-8253-b9fae7338552" | "5bb33afe-a528-414c-9553-3ea5ceb1b97b" |

  Scenario Outline: Request items ordered by field values
    Given the following service groups exist:
      | <field>           |
      | <alternate_value> |
      | <expected_value>  |
    And my scope is "service_catalog:read"
    And my client type is "NHS"
    When I request first 10 service groups sorted by <field> in <direction> order
    Then no errors should be returned
    And I should receive collection with 2 items
    And the <field> of the first item in the collection should be <expected_value>

    Examples:
      | field      | direction  | expected_value                | alternate_value               |
      | insertedAt | ascending  | "2017-01-24T19:15:01.000000Z" | "2018-04-21T12:29:05.000000Z" |
      | insertedAt | descending | "2018-04-21T12:29:05.000000Z" | "2017-01-24T19:15:01.000000Z" |
      | name       | ascending  | "Загальне обстеження хворого" | "Ультразвукові дослідження"   |
      | name       | descending | "Ультразвукові дослідження"   | "Загальне обстеження хворого" |

Input parameters (filters)

  • id (optional)

  • code (optional)

  • name (optional, as `LIKE *`)

  • isActive (optional)

Logic WS

  1. Check user scopes in order to perform this action (scope = 'service_catalog:read')

  2. Search Services by filters in payload

    SELECT * FROM service_groups
    WHERE parent_group_id in (
    	SELECT id FROM service_groups
    	WHERE is_active = 'True') 
    or  parent_group_id is NULL
    
    



  • No labels