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

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

 Features
Feature: Create service

  Scenario Outline: Successful creation
    Given my scope is "service_catalog:write"
    And my client type is "NHS"
    And my consumer ID is "8341b7d6-f9c7-472a-960c-7da953cc4ea4"
    When I create service with attributes:
      | name   | category   | code   | isComposition   | requestAllowed   |
      | <name> | <category> | <code> | <isComposition> | <requestAllowed> |
    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 <name>
    And the code of the requested item should be <code>
    And the category of the requested item should be <category>
    And the isComposition of the requested item should be <isComposition>
    And the requestAllowed of the requested item should be <requestAllowed>

    Examples:
      | name              | category               | code     | isComposition | requestAllowed |
      | "Нейросонографія" | "laboratory_procedure" | "AF2 01" | false         | true           |

  Scenario: Successful creation with deactivated existing code
    Given the following services exist:
      | code     | isActive |
      | "AF2 01" | false    |
    And my scope is "service_catalog:write"
    And my client type is "NHS"
    And my consumer ID is "8341b7d6-f9c7-472a-960c-7da953cc4ea4"
    When I create service with attributes:
      | name              | category               | code     | isComposition | requestAllowed |
      | "Нейросонографія" | "laboratory_procedure" | "AF2 01" | false         | true           |
    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 "AF2 01"

  Scenario: Create with incorrect scope
    Given my scope is "service_catalog:read"
    And my consumer ID is "04796283-74b8-4632-9f7f-9e227ae9426e"
    And the following dictionaries exist:
      | name               | values                                          |
      | "SERVICE_CATEGORY" | {"laboratory_procedure": "Лабораторні послуги"} |
    When I create service with attributes:
      | name              | category              | code     | isComposition |
      | "Нейросонографія" | "laboratory_procedure"| "AF2 01" | true          |
    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"
    And the following dictionaries exist:
      | name               | values                                          |
      | "SERVICE_CATEGORY" | {"laboratory_procedure": "Лабораторні послуги"} |
    When I create service with attributes:
      | name              | category    | code     | isComposition |
      | "Нейросонографія" | "education" | "AF2 01" | true         |
    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 "8341b7d6-f9c7-472a-960c-7da953cc4ea4"
    And the following dictionaries exist:
      | name               | values                                                               |
      | "SERVICE_CATEGORY" | {"imaging": "Послуги з аналізу та інтерпретації медичних зображень"} |
    When I create service with attributes:
      | name   | category   | code   | isComposition   |
      | <name> | <category> | <code> | <isComposition> |
    Then the "UNPROCESSABLE_ENTITY" error should be returned
    And request id should be returned
    And I should not receive requested item

    Examples:
      | name              | category    | code  | isComposition |
      | "Нейросонографія" | "education" | "000" | false         |
      | "Нейросонографія" | "imaging"   | ""    | false         |
      | ""                | "education" | "123" | false         |

  Scenario: Create with already existing code
    Given the following services exist:
      | code     | isActive |
      | "AF2 01" | true     |
    And my scope is "service_catalog:write"
    And my client type is "NHS"
    And my consumer ID is "8341b7d6-f9c7-472a-960c-7da953cc4ea4"
    When I create service with attributes:
      | name              | category               | code     | isComposition | requestAllowed |
      | "Нейросонографія" | "laboratory_procedure" | "AF2 01" | true          | true           |
    Then the "UNPROCESSABLE_ENTITY" error should be returned
    And request id should be returned
    And I should not receive requested item

Input parameters

  • name

  • code

  • category

  • requestAllowed

  • isComposition (not used yet)

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

Validate request

Validate request using features.

Validate code

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

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

Create new Innm

  1. Create new record in `innms`

  2. Fill data


Destination

Source

id


name

$.name

code

$.code

is_active

TRUE

category

$.category

is_composition

$.is_composition

request_allowed

$.request_allowed

inserted_at

:timestamp

inserted_by

user_id

updated_at

:timestamp

updated_by

user_id



  • No labels