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

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

Version 1 Next »

Purpose

This WS allows to find rule engine rules in Admin panel using search params.

Key points

  1. This is a graphQl query method used in Administration panel only.

  2. Only authenticated and authorized NHS employee with appropriate scope can search Rule engine rules.

Specification

"""
Fields to filter rule engine rules in the system.
"""
input RuleEngineRuleFilter {
  "Checks for equality with the object’s `databaseId` field."
  databaseId: UUID
  "Checks for matching with the object’s `name` field."
  name: String
  "Checks for equality with the object’s `isActive` field."
  isActive: Boolean
  "Checks for equality with the object’s `code.code` field."
  code: String
  "Checks for equality with the object’s `code.system` field."
  system: String  
}

"""
Methods to use when ordering `RuleEngineRule`.
"""
enum RuleEngineRuleOrderBy {
  "Orders by the object’s `insertedAt` field in the ascending order."
  INSERTED_AT_ASC
  "Orders by the object’s `insertedAt` field in the descending order."
  INSERTED_AT_DESC
  "Orders by the object’s `name` field in the ascending order."
  NAME_ASC
  "Orders by the object’s `name` field in the descending order."
  NAME_DESC
}

"""
A connection to a list of `RuleEngineRule` items.
"""
type RuleEngineRuleConnection {
  "Information to aid in pagination."
  pageInfo: PageInfo!
  "A list of nodes."
  nodes: [RuleEngineRule]
  "A list of edges."
  edges: [RuleEngineRuleEdge]
}

"""
An edge in a connection of `RuleEngineRule`.
"""
type RuleEngineRuleEdge {
  "The item at the end of the edge."
  node: RuleEngineRule!
  "A cursor for use in pagination."
  cursor: String!
}

"""
RuleEngineRule contains set of rules.
In order to obtain details user must have a scope **rule_engine_set:details**
"""
type RuleEngineRule implements Node {
  "The ID of an object."
  id: ID!
  "Primary key identifier from the database."
  databaseId: UUID!
  "The name of the `RuleEngineRule`."
  name: String!
  "Additional information about `RuleEngineRule`."
  code: Coding!  
  "Description of the `RuleEngineRule`."
  description: String
  "The reason the `RuleEngineRule` was deactivated."
  deactivationReason: String
  "Whether the `RuleEngineRule` is active or not."
  isActive: Boolean!
  "Date and time when record was inserted."
  insertedAt: DateTime!
  "Date and time when record was updated."
  updatedAt: DateTime!
  "Set of rules that belong to `RuleEngineRule`."
  value: RuleEngineRuleValue!
}

"""
Type for additional information about `ruleEngineRuleValue`.
"""
type RuleEngineRuleValue {
  "Rule engine rule in human readable format."
  string: String!
  "Rule engine rule in JsonLogic format."
  json: JSON!
}

Authorization

  • Verify the validity of access token

    • in case of error - return 401 (“Invalid access token”) in case of validation fails

  • Verify that token is not expired

    • in case of error - return 401 (“Invalid access token”)

  • Check user scopes in order to perform this action (scope = 'rule_engine_rule:details')

    • return 403 (“Your scope does not allow to access this resource. Missing allowances: rule_engine_rule:details”) in case of invalid scope(s)

Validate legal entity

  • Extract client_id from token.

  • Check client scopes in order to perform this action (scope = 'rule_engine_rule:details')

    • in case of error - return 403 (“Your scope does not allow to access this resource. Missing allowances: rule_engine_rule:details”)

  • Check client type (type = NHS)

    • In case of error - return 403 ('You don't have permission to access this resource')

Search params

Search with a few params performs according to the logical AND rule.

  1. id. Search by rule_engine_rules.id (used to get rule engine rule details)

  2. name. Search by rule_engine_rules.name

  3. is_active. Search by rule_engine_rules.is_active

  4. code.system. Searches by rule_engine_rules.code.system

  5. code.value. Searches by rule_engine_rules.code.value

Service logic

Render a response according to search params.

  • No labels