From 1685b845575d5a80321fa1431c4c32f850b943a2 Mon Sep 17 00:00:00 2001 From: naftis Date: Wed, 11 Dec 2024 22:04:41 +0200 Subject: [PATCH 1/3] feat: allow supplying a comment with confirmRegistration --- .../gateway/src/features/registration/root-resolvers.ts | 5 +---- packages/gateway/src/features/registration/schema.graphql | 1 + packages/gateway/src/graphql/schema.d.ts | 1 + packages/gateway/src/graphql/schema.graphql | 1 + packages/gateway/src/workflow/index.ts | 1 + packages/workflow/src/features/registration/handler.ts | 6 ++++-- packages/workflow/src/records/fhir.ts | 7 +++++-- packages/workflow/src/records/state-transitions.ts | 7 +++++-- 8 files changed, 19 insertions(+), 10 deletions(-) diff --git a/packages/gateway/src/features/registration/root-resolvers.ts b/packages/gateway/src/features/registration/root-resolvers.ts index 2e801ceef67..385f40d7c5b 100644 --- a/packages/gateway/src/features/registration/root-resolvers.ts +++ b/packages/gateway/src/features/registration/root-resolvers.ts @@ -612,10 +612,7 @@ export const resolvers: GQLResolver = { } try { - const taskEntry = await confirmRegistration(id, authHeader, { - registrationNumber: details.registrationNumber, - identifiers: details.identifiers - }) + const taskEntry = await confirmRegistration(id, authHeader, details) return taskEntry.resource.id } catch (error) { diff --git a/packages/gateway/src/features/registration/schema.graphql b/packages/gateway/src/features/registration/schema.graphql index 6a1d16902e9..e6081b57e3c 100644 --- a/packages/gateway/src/features/registration/schema.graphql +++ b/packages/gateway/src/features/registration/schema.graphql @@ -571,6 +571,7 @@ input IdentifierInput { input ConfirmRegistrationInput { registrationNumber: String! identifiers: [IdentifierInput!] + comment: String # For record audit } input RejectRegistrationInput { diff --git a/packages/gateway/src/graphql/schema.d.ts b/packages/gateway/src/graphql/schema.d.ts index e9382585d55..1d9ced2d614 100644 --- a/packages/gateway/src/graphql/schema.d.ts +++ b/packages/gateway/src/graphql/schema.d.ts @@ -603,6 +603,7 @@ export interface GQLReinstated { export interface GQLConfirmRegistrationInput { registrationNumber: string identifiers?: Array + comment?: string } export interface GQLRejectRegistrationInput { diff --git a/packages/gateway/src/graphql/schema.graphql b/packages/gateway/src/graphql/schema.graphql index a46a4924920..bb1dfa6e8e2 100644 --- a/packages/gateway/src/graphql/schema.graphql +++ b/packages/gateway/src/graphql/schema.graphql @@ -740,6 +740,7 @@ type Reinstated { input ConfirmRegistrationInput { registrationNumber: String! identifiers: [IdentifierInput!] + comment: String } input RejectRegistrationInput { diff --git a/packages/gateway/src/workflow/index.ts b/packages/gateway/src/workflow/index.ts index 317fb86fc48..841b6a3a4a4 100644 --- a/packages/gateway/src/workflow/index.ts +++ b/packages/gateway/src/workflow/index.ts @@ -246,6 +246,7 @@ export async function confirmRegistration( details: { registrationNumber: string identifiers?: IdentifierInput[] + comment?: string } ) { const res: ReadyForReviewRecord = await createRequest( diff --git a/packages/workflow/src/features/registration/handler.ts b/packages/workflow/src/features/registration/handler.ts index c9e9ec555b5..8dd7c68b7c3 100644 --- a/packages/workflow/src/features/registration/handler.ts +++ b/packages/workflow/src/features/registration/handler.ts @@ -25,7 +25,8 @@ import { SupportedPatientIdentifierCode } from '@opencrvs/commons/types' export interface EventRegistrationPayload { trackingId: string registrationNumber: string - error: string + error?: string + comment?: string identifiers?: { type: SupportedPatientIdentifierCode value: string @@ -38,7 +39,7 @@ export async function markEventAsRegisteredCallbackHandler( ) { const token = getToken(request) const compositionId = request.params.id - const { registrationNumber, error, identifiers } = + const { registrationNumber, error, comment, identifiers } = request.payload as EventRegistrationPayload if (error) { @@ -60,6 +61,7 @@ export async function markEventAsRegisteredCallbackHandler( savedRecord, registrationNumber, token, + comment, identifiers ) const event = getEventType(bundle) diff --git a/packages/workflow/src/records/fhir.ts b/packages/workflow/src/records/fhir.ts index 89558fb4806..396f306d0f4 100644 --- a/packages/workflow/src/records/fhir.ts +++ b/packages/workflow/src/records/fhir.ts @@ -763,7 +763,10 @@ export function createWaitingForValidationTask( } } -export function createRegisterTask(previousTask: SavedTask): Task { +export function createRegisterTask( + previousTask: SavedTask, + comment?: string +): Task { const timeLoggedMSExtension = previousTask.extension.find( (e) => e.url === 'http://opencrvs.org/specs/extension/timeLoggedMS' )! @@ -774,7 +777,7 @@ export function createRegisterTask(previousTask: SavedTask): Task { 'REGISTERED' ) - const comments = previousTask?.note?.[0]?.text + const comments = comment ?? previousTask?.note?.[0]?.text return { ...registeredTask, diff --git a/packages/workflow/src/records/state-transitions.ts b/packages/workflow/src/records/state-transitions.ts index 68f0dbb8a71..24bc3d07e29 100644 --- a/packages/workflow/src/records/state-transitions.ts +++ b/packages/workflow/src/records/state-transitions.ts @@ -509,11 +509,14 @@ export async function toRegistered( record: WaitingForValidationRecord, registrationNumber: EventRegistrationPayload['registrationNumber'], token: string, + comment?: string, identifiers?: EventRegistrationPayload['identifiers'] ): Promise { const previousTask = getTaskFromSavedBundle(record) - const registeredTaskWithoutPractitionerExtensions = - createRegisterTask(previousTask) + const registeredTaskWithoutPractitionerExtensions = createRegisterTask( + previousTask, + comment + ) const [registeredTask, practitionerResourcesBundle] = await withPractitionerDetails( From 99475272129ce74c1360edf69c3a844c5a6ef53c Mon Sep 17 00:00:00 2001 From: Pyry Date: Fri, 20 Dec 2024 10:59:41 +0900 Subject: [PATCH 2/3] trigger e2e From 7c4198d12aae52ae1be1fd9766ec2ddb9876821c Mon Sep 17 00:00:00 2001 From: Pyry Date: Mon, 6 Jan 2025 12:38:19 +0900 Subject: [PATCH 3/3] chore: update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac7e465064d..2ba52a97549 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,6 @@ ### New features -- Misc new feature - Allow configuring the default search criteria for record search [#6924](https://github.com/opencrvs/opencrvs-core/issues/6924) - Add checks to validate client and server are always on the same version. This prevents browsers with a cached or outdated client versions from making potentially invalid requests to the backend [#6695](https://github.com/opencrvs/opencrvs-core/issues/6695) - Two new statuses of record are added: `Validated` and `Correction Requested` for advanced search parameters [#6365](https://github.com/opencrvs/opencrvs-core/issues/6365) @@ -24,6 +23,7 @@ - **Template Selection Dropdown**: Updated print workflow to include a dropdown menu for template selection when issuing a certificate. - Auth now allows exchanging user's token for a new record-specific token [#7728](https://github.com/opencrvs/opencrvs-core/issues/7728) - A new GraphQL mutation `upsertRegistrationIdentifier` is added to allow updating the patient identifiers of a registration record such as NID [#8034](https://github.com/opencrvs/opencrvs-core/pull/8034) +- Updated GraphQL mutation `confirmRegistration` to allow adding a `comment` for record audit [#8197](https://github.com/opencrvs/opencrvs-core/pull/8197) - Introduced a new customisable UI component: Banner [#8276](https://github.com/opencrvs/opencrvs-core/issues/8276) ### Improvements