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

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 Current »

Purpose

This WS allows to find Device registry Jobs 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 Device registry Jobs

  3. Query returns a list of Device registry Jobs filtered by search params

Specification

 index.graphql
  "Reads and enables pagination through a set of `DeviceRegistryJob`."
  deviceRegistryJobs(
    "A condition to be used in determining which values should be returned by the collection."
    filter: DeviceRegistryJobFilter
    "The method to use when ordering collection items."
    orderBy: DeviceRegistryJobOrderBy
    "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
  ): DeviceRegistryJobConnection!
 deviceRegistryJobs.graphql
"""
Filter for Device registry job.
"""
input DeviceRegistryJobFilter {
  "Device registry job status filters."
  status: JobStatus
}

"""
List of fields to sort both asc and desc side `DeviceRegistryJob`.
"""
enum DeviceRegistryJobOrderBy {
  "Sort Device registry job by started at in ascending order"
  STARTED_AT_ASC
  "Sort Device registry job by started at in descending order"
  STARTED_AT_DESC
}

"""
A connection to a list of `DeviceRegistryJob` values.
"""
type DeviceRegistryJobConnection {
  "Information to aid in pagination."
  pageInfo: PageInfo!
  "A list of nodes."
  nodes: [DeviceRegistryJob]
  "A list of edges."
  edges: [DeviceRegistryJobEdge]
}

"""
Reads and enables pagination through a set of `DeviceRegistryJob`.
"""
type DeviceRegistryJobEdge {
  "The item at the end of the edge."
  node: DeviceRegistryJob!
  "A cursor for use in pagination."
  cursor: String!
}

"""
An object for DeviceRegistryJob.
"""
type DeviceRegistryJob implements Node {
  "The ID of an object"
  id: ID!
  "Primary key identifier from the database"
  databaseId: UUID!
  "Job name."
  name: String
  "Device registry Job status."
  status: JobStatus!
  "Job execution strategy."
  strategy: JobStrategy!
  "Date and time when the job starts."
  startedAt: DateTime!
  "Date and time when the job ends."
  endedAt: DateTime
  "Tasks within this job."
  tasks(
    "A condition to be used in determining which values should be returned by the collection."
    filter: TaskFilter
    "The method to use when ordering collection items."
    orderBy: TaskOrderBy
    "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
  ): TaskConnection!
  "Type of register originating device registry data. The value should be present in the `REGISTER_TYPE` dictionary."
  registerType: String!
  "Device registry job reason description."
  reasonDescription: String!
}

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 = 'device_registry_job:read')

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

Validate legal entity

  • Extract client_id from token.

  • Check legal entity status (status = ACTIVE)

    • In case of error - return 409 ('client_id refers to legal entity that is not active')

  • Check client type (type = NHS)

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

Service logic

  1. Get list of all Device registry Jobs from jobs table in JABBA DB, filtered by:

    1. device registry job types (jabba.jobs.type):

      1. upload_device_definitions_registry

    2. submitted additional search params

      1. status. Search by jobs.status

  2. Apply optional ordering

    1. by default order records by inserted_at field in descending order

  3. Render a response according to specification

  • No labels