Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Purpose

API paragraph not found

Specification

Page Properties
idAPI_Specification

Link

Посилання на Apiary або Swagger

Resource

Посилання на ресурс, наприклад: /api/persons/create

Scope

service_catalog:read

Scope для доступу

Components

Зазначається перелік бізнес компонентів, які використовують цей метод, наприклад: ePrescription

Microservices

Перелік мікросервісів, які використовує метод API, наприклад: Auth, ABAC

Protocol type

Тип протоколу, який використовується запитом, наприклад: SOAP | REST

Request type

Тип запиту API, наприклад: GET, POST, PATCH…

Sync/Async

Метод є синхронним чи асинхронним?

Public/Private/Internal

Потрібно зазначити тип методу за ступенем доступності

Expand
titleSchema
Code Block
"""
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!
}
Expand
titleFeatures - Get all
Code Block
Feature: Get all services

  Scenario Outline: Request items filtered by condition
    Given the following services exist:
      | <field>           |
      | <alternate_value> |
      | <expected_value>  |
    And my scope is "service_catalog:read"
    And my client type is "NHS"
    When I request first 10 services 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 | "85a3f45f-1cfa-4595-ac57-79a9d39ee329" | "85a3f45f-1cfa-4595-ac57-79a9d39ee329" | "4c3f59da-727a-48cf-8e7c-eb5b36578133" |
      | name       | "нейросоно"                            | "Нейросонографія"                      | "Ехоенцефалографія"                    |
      | isActive   | true                                   | true                                   | false                                  |
      | code       | "AF2"                                  | "AF2 01"                               | "BF2"                                  |
      | category   | "УЗі"                                  | "УЗІ кишечника"                        | "аналіз крові"                         |

  Scenario Outline: Request items ordered by field values
    Given the following services exist:
      | <field>           |
      | <alternate_value> |
      | <expected_value>  |
    And my scope is "service_catalog:read"
    And my client type is "NHS"
    When I request first 10 services 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  | "2016-01-15T14:00:00.000000Z" | "2017-05-13T17:00:00.000000Z" |
      | insertedAt | descending | "2017-05-13T17:00:00.000000Z" | "2016-01-15T14:00:00.000000Z" |
      | name       | ascending  | "Ехоенцефалографія"           | "Нейросонографія"             |
      | name       | descending | "Нейросонографія"             | "Ехоенцефалографія"           |
      | code       | ascending  | "AF2"                         | "BF2"                         |
      | code       | descending | "BF2"                         | "BF1"                         |

Logic

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

  2. Search Services by filters in payload

    Code Block
    languagesql
    SELECT * FROM services
    

Filters

Filter

Values

Type

Description

Example

id

optional

code

optional

name

optional, as `LIKE *`

category

optional, from `SERVICE_CATALOG` dictionary

isActive

optional

Request structure

API paragraph not found

 

Authorize

API paragraph not found

Headers

API paragraph not found

Request data validation

API paragraph not found

Processing

API paragraph not found

Response structure

API paragraph not found

Post-processing processes

API paragraph not found

HTTP status codes

API paragraph not found