From 1695fb12a3f778c47f2c8e0de8de3c3149da651d Mon Sep 17 00:00:00 2001 From: Siyasanga Mtshokotsha Date: Thu, 17 Oct 2024 15:07:19 +0200 Subject: [PATCH] feat: Update the order of system user add/edit form fields and labels and remove NID field (#7697) * Ask surname first in the User details form we often receive requests from countries to have the surname first in this form, we have decided to satisfy that requirement by putting surname first for ALL countries. https://github.com/opencrvs/opencrvs-core/issues/6830 * Change name and surname labels for User Details form A request came for the clients to change the labels for "First name(s)" to "User's first name". Also change "Last name" to "User's surname" for clarity and less confussion. https://github.com/opencrvs/opencrvs-core/issues/6830 * Remove NID field from the user details form Remove the question that asks the user for a national ID number in this form as it is not required https://github.com/opencrvs/opencrvs-core/issues/6830 * Remove lang suffix for FamilyName field We no longer need the suffixes for the FamilyName field since we not really using it anywhere https://github.com/opencrvs/opencrvs-core/issues/6830 * Add migration to remove NID field from user A requirement from client to remove the NID field since most of the contries are not really using it. https://github.com/opencrvs/opencrvs-core/issues/6830 * Record changes in the CHANGELOG To keep track of changes done on this PR https://github.com/opencrvs/opencrvs-core/issues/6830 * Remove Eng suffix for the firstName in user form We currently don't support milti language support for both surname and first names so the ENG/EN suffixes are not needed. Also remove EN bits that were left for the surname field https://github.com/opencrvs/opencrvs-core/issues/6830 --------- Co-authored-by: Siyasanga Mtshokotsha Co-authored-by: Siyasanga Mtshokotsha --- CHANGELOG.md | 1 + .../forms/user/fieldDefinitions/createUser.ts | 40 +++---------- .../src/i18n/messages/views/userForm.ts | 21 +++---- packages/client/src/tests/forms.json | 58 +------------------ packages/client/src/tests/util.tsx | 45 +++----------- .../user/userCreation/CreateNewUser.test.tsx | 11 +--- .../Team/user/userCreation/UserReviewForm.tsx | 2 +- .../registration/type-resolvers.test.ts | 1 - .../src/features/user/root-resolvers.ts | 2 - .../src/features/user/type-resolvers.test.ts | 8 --- .../src/features/user/type-resolvers.ts | 12 +--- .../20241007100507-remove-nid-field.ts | 42 ++++++++++++++ .../src/features/activateUser/handler.test.ts | 1 - .../src/features/changeAvatar/handler.test.ts | 1 - .../src/features/changeEmail/handler.test.ts | 1 - .../features/changePassword/handler.test.ts | 2 - .../src/features/changePhone/handler.test.ts | 1 - .../src/features/createUser/handler.test.ts | 3 - .../src/features/createUser/service.ts | 2 - .../src/features/resendInvite/handler.test.ts | 1 - .../features/resetPassword/handler.test.ts | 1 - .../src/features/updateUser/handler.test.ts | 4 -- .../src/features/updateUser/handler.ts | 1 - .../src/features/userAudit/handler.test.ts | 1 - .../features/userSearchRecord/handler.test.ts | 1 - .../usernameSMSReminderInvite/handler.test.ts | 1 - .../features/verifyPassword/handler.test.ts | 1 - .../verifySecurityAnswer/handler.test.ts | 1 - packages/user-mgnt/src/model/user.ts | 6 -- 29 files changed, 73 insertions(+), 199 deletions(-) create mode 100644 packages/migration/src/migrations/user-mgnt/20241007100507-remove-nid-field.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 4311c266fa4..5a22ee34320 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ - Two new statuses of record are added: `Validated` and `Correction Requested` for advanced search parameters [#6365](https://github.com/opencrvs/opencrvs-core/issues/6365) - A new field: `Time Period` is added to advanced search [#6365](https://github.com/opencrvs/opencrvs-core/issues/6365) - Deploy UI-Kit Storybook to [opencrvs.pages.dev](https://opencrvs.pages.dev) to allow extending OpenCRVS using the component library +- Reoder the sytem user add/edit field for surname to be first, also change labels from `Last name` to `User's surname` and lastly remove the NID question from the form [#6830](https://github.com/opencrvs/opencrvs-core/issues/6830) ## Bug fixes diff --git a/packages/client/src/forms/user/fieldDefinitions/createUser.ts b/packages/client/src/forms/user/fieldDefinitions/createUser.ts index 37332d9fa9a..d89a71dfc8b 100644 --- a/packages/client/src/forms/user/fieldDefinitions/createUser.ts +++ b/packages/client/src/forms/user/fieldDefinitions/createUser.ts @@ -18,7 +18,6 @@ import { UserSection } from '@client/forms/index' import { messages as userFormMessages } from '@client/i18n/messages/views/userForm' -import { NATIONAL_ID } from '@client/utils/constants' export function userSectionFormType(): ISerializedFormSection { return { @@ -79,38 +78,38 @@ export function userSectionFormType(): ISerializedFormSection { title: userFormMessages.userDetails, fields: [ { - name: 'firstNamesEng', + name: 'familyName', type: TEXT, - label: userFormMessages.firstNameEn, + label: userFormMessages.lastName, required: true, initialValue: '', validator: [{ operation: 'englishOnlyNameFormat' }], mapping: { mutation: { operation: 'fieldToNameTransformer', - parameters: ['en', 'firstNames'] + parameters: ['en', 'familyName'] }, query: { operation: 'nameToFieldTransformer', - parameters: ['en', 'firstNames'] + parameters: ['en', 'familyName'] } } }, { - name: 'familyNameEng', + name: 'firstName', type: TEXT, - label: userFormMessages.lastNameEn, + label: userFormMessages.firstName, required: true, initialValue: '', validator: [{ operation: 'englishOnlyNameFormat' }], mapping: { mutation: { operation: 'fieldToNameTransformer', - parameters: ['en', 'familyName'] + parameters: ['en', 'firstNames'] }, query: { operation: 'nameToFieldTransformer', - parameters: ['en', 'familyName'] + parameters: ['en', 'firstNames'] } } }, @@ -152,29 +151,6 @@ export function userSectionFormType(): ISerializedFormSection { initialValue: '', validator: [{ operation: 'emailAddressFormat' }] }, - { - name: 'nid', - type: TEXT, - label: userFormMessages.NID, - required: false, - initialValue: '', - validator: [ - { - operation: 'validIDNumber', - parameters: [NATIONAL_ID] - } - ], - mapping: { - mutation: { - operation: 'fieldToIdentifierWithTypeTransformer', - parameters: [NATIONAL_ID] - }, - query: { - operation: 'identifierWithTypeToFieldTransformer', - parameters: [NATIONAL_ID] - } - } - }, { name: 'seperator', type: 'DIVIDER', diff --git a/packages/client/src/i18n/messages/views/userForm.ts b/packages/client/src/i18n/messages/views/userForm.ts index f4919dd6a58..f4b46709183 100644 --- a/packages/client/src/i18n/messages/views/userForm.ts +++ b/packages/client/src/i18n/messages/views/userForm.ts @@ -49,15 +49,15 @@ export const messages = { description: 'User details section', id: 'form.section.userDetails' }, - firstNameEn: { - defaultMessage: 'First name', - description: 'English first name', - id: 'form.field.label.firstNameEN' + firstName: { + defaultMessage: "User's first name", + description: "User's English first name", + id: 'form.field.label.userFirstName' }, - lastNameEn: { - defaultMessage: 'Last name', - description: 'English last name', - id: 'form.field.label.lastNameEN' + lastName: { + defaultMessage: "User's surname", + description: "User's English surname", + id: 'form.field.label.userSurname' }, phoneNumber: { defaultMessage: 'Phone number', @@ -69,11 +69,6 @@ export const messages = { description: 'Input label for email address', id: 'form.field.label.email' }, - NID: { - defaultMessage: 'NID', - description: 'National ID', - id: 'form.field.label.NID' - }, accountDetails: { defaultMessage: 'Account details', description: 'Account details section', diff --git a/packages/client/src/tests/forms.json b/packages/client/src/tests/forms.json index c716177a3f3..07a7aefd20e 100644 --- a/packages/client/src/tests/forms.json +++ b/packages/client/src/tests/forms.json @@ -12203,7 +12203,7 @@ "label": { "defaultMessage": "Last name", "description": "English last name", - "id": "form.field.label.lastNameEN" + "id": "form.field.label.userSurname" }, "required": true, "initialValue": "", @@ -12264,33 +12264,6 @@ } } }, - { - "name": "nid", - "type": "TEXT", - "label": { - "defaultMessage": "NID", - "description": "National ID", - "id": "form.field.label.NID" - }, - "required": false, - "initialValue": "", - "validate": [ - { - "operation": "validIDNumber", - "parameters": ["NATIONAL_ID"] - } - ], - "mapping": { - "mutation": { - "operation": "fieldToIdentifierWithTypeTransformer", - "parameters": ["NATIONAL_ID"] - }, - "query": { - "operation": "identifierWithTypeToFieldTransformer", - "parameters": ["NATIONAL_ID"] - } - } - }, { "name": "seperator", "type": "SUBSECTION", @@ -12555,7 +12528,7 @@ "label": { "defaultMessage": "Last name", "description": "English last name", - "id": "form.field.label.lastNameEN" + "id": "form.field.label.userSurname" }, "required": true, "initialValue": "", @@ -12616,33 +12589,6 @@ } } }, - { - "name": "nid", - "type": "TEXT", - "label": { - "defaultMessage": "NID", - "description": "National ID", - "id": "form.field.label.NID" - }, - "required": false, - "initialValue": "", - "validate": [ - { - "operation": "validIDNumber", - "parameters": ["NATIONAL_ID"] - } - ], - "mapping": { - "mutation": { - "operation": "fieldToIdentifierWithTypeTransformer", - "parameters": ["NATIONAL_ID"] - }, - "query": { - "operation": "identifierWithTypeToFieldTransformer", - "parameters": ["NATIONAL_ID"] - } - } - }, { "name": "seperator", "type": "SUBSECTION", diff --git a/packages/client/src/tests/util.tsx b/packages/client/src/tests/util.tsx index b74eeb33b53..4e49085df6e 100644 --- a/packages/client/src/tests/util.tsx +++ b/packages/client/src/tests/util.tsx @@ -1446,10 +1446,8 @@ export const mockCompleteFormData = { accountDetails: '', assignedRegistrationOffice: '', device: '', - familyName: 'হোসেন', - familyNameEng: 'Hossain', - firstNames: 'Jeff', - firstNamesEng: 'Jeff', + familyName: 'Hossain', + firstName: 'Jeff', nid: '123456789', phoneNumber: '01662132132', email: 'jeff.hossain@gmail.com', @@ -1600,7 +1598,7 @@ export const mockUserGraphqlOperation = { } }, { - name: 'firstNamesEng', + name: 'firstNames', type: 'TEXT', label: { defaultMessage: 'English first name', @@ -1622,12 +1620,12 @@ export const mockUserGraphqlOperation = { } }, { - name: 'familyNameEng', + name: 'familyName', type: 'TEXT', label: { defaultMessage: 'English last name', description: 'English last name', - id: 'form.field.label.lastNameEN' + id: 'form.field.label.userSurname' }, required: true, initialValue: '', @@ -1665,33 +1663,6 @@ export const mockUserGraphqlOperation = { } } }, - { - name: 'nid', - type: 'TEXT', - label: { - defaultMessage: 'NID', - description: 'National ID', - id: 'form.field.label.NID' - }, - required: true, - initialValue: '', - validator: [ - { - operation: 'validIDNumber', - parameters: ['NATIONAL_ID'] - } - ], - mapping: { - mutation: { - operation: 'fieldToIdentifierWithTypeTransformer', - parameters: ['NATIONAL_ID'] - }, - query: { - operation: 'identifierWithTypeToFieldTransformer', - parameters: ['NATIONAL_ID'] - } - } - }, { name: 'accountDetails', type: 'FIELD_GROUP_TITLE', @@ -1822,10 +1793,8 @@ export const mockDataWithRegistarRoleSelected = { accountDetails: '', assignedRegistrationOffice: '', device: '', - familyName: 'হোসেন', - familyNameEng: 'Hossain', - firstNames: 'Jeff', - firstNamesEng: 'Jeff', + familyName: 'Hossain', + firstName: 'Jeff', email: 'jeff@gmail.com', nid: '101488192', phoneNumber: '01662132132', diff --git a/packages/client/src/views/SysAdmin/Team/user/userCreation/CreateNewUser.test.tsx b/packages/client/src/views/SysAdmin/Team/user/userCreation/CreateNewUser.test.tsx index e4e0b8988f4..1c490b511c6 100644 --- a/packages/client/src/views/SysAdmin/Team/user/userCreation/CreateNewUser.test.tsx +++ b/packages/client/src/views/SysAdmin/Team/user/userCreation/CreateNewUser.test.tsx @@ -230,7 +230,7 @@ describe('create new user tests', () => { expect( testComponent .find(FormFieldGenerator) - .find('#familyNameEng_error') + .find('#familyName_error') .hostNodes() .text() ).toBe('Required to register a new user') @@ -288,13 +288,13 @@ describe('create new user tests', () => { it('clicking change button on a field takes user back to form', async () => { testComponent - .find('#btn_change_firstNamesEng') + .find('#btn_change_firstName') .hostNodes() .first() .simulate('click') await flushPromises() expect(history.location.pathname).toBe('/createUser/user/user-view-group') - expect(history.location.hash).toBe('#firstNamesEng') + expect(history.location.hash).toBe('#firstName') }) it('clicking submit button submits the form data', async () => { @@ -339,11 +339,6 @@ describe('edit user tests', () => { username: 'shakib1', mobile: '+8801662132163', email: 'jeff@gmail.com', - identifier: { - system: 'NATIONAL_ID', - value: '101488192', - __typename: 'Identifier' - }, systemRole: 'NATIONAL_REGISTRAR', role: { _id: '63ef9466f708ea080777c27a' }, status: 'active', diff --git a/packages/client/src/views/SysAdmin/Team/user/userCreation/UserReviewForm.tsx b/packages/client/src/views/SysAdmin/Team/user/userCreation/UserReviewForm.tsx index b35c49cef61..e5dfad507f0 100644 --- a/packages/client/src/views/SysAdmin/Team/user/userCreation/UserReviewForm.tsx +++ b/packages/client/src/views/SysAdmin/Team/user/userCreation/UserReviewForm.tsx @@ -249,7 +249,7 @@ class UserReviewFormComponent extends React.Component< (field) => field.name === 'firstNamesEng' ) as IFormField const familyNameEngField = fields.find( - (field) => field.name === 'familyNameEng' + (field) => field.name === 'familyName' ) as IFormField return `${this.getValue(firstNamesEngField)} ${this.getValue( diff --git a/packages/gateway/src/features/registration/type-resolvers.test.ts b/packages/gateway/src/features/registration/type-resolvers.test.ts index 26e6f987f20..19277f13671 100644 --- a/packages/gateway/src/features/registration/type-resolvers.test.ts +++ b/packages/gateway/src/features/registration/type-resolvers.test.ts @@ -51,7 +51,6 @@ const MOCK_USER: IUserModelData = { } ], username: 'd.bulaya', - identifiers: [], email: '', device: 'Samsung Galaxy S9', emailForNotification: 'kalushabw.alya17@gmail.com', diff --git a/packages/gateway/src/features/user/root-resolvers.ts b/packages/gateway/src/features/user/root-resolvers.ts index 08497c6b00a..4b3e213f3cd 100644 --- a/packages/gateway/src/features/user/root-resolvers.ts +++ b/packages/gateway/src/features/user/root-resolvers.ts @@ -26,7 +26,6 @@ import { GQLHumanNameInput, GQLResolver, GQLSearchFieldAgentResponse, - GQLUserIdentifierInput, GQLUserInput } from '@gateway/graphql/schema' import { logger, isBase64FileString } from '@opencrvs/commons' @@ -640,7 +639,6 @@ function createOrUpdateUserPayload(user: GQLUserInput): IUserPayload { role: user.role as string, ...(user.password && { password: user.password }), ...(user.status && { status: user.status }), - identifiers: (user.identifier as GQLUserIdentifierInput[]) || [], primaryOfficeId: user.primaryOffice as string, email: '', ...(user.email && { emailForNotification: user.email }), //instead of saving data in email, we want to store it in emailForNotification property diff --git a/packages/gateway/src/features/user/type-resolvers.test.ts b/packages/gateway/src/features/user/type-resolvers.test.ts index f6e6bce9a54..e7223b6933b 100644 --- a/packages/gateway/src/features/user/type-resolvers.test.ts +++ b/packages/gateway/src/features/user/type-resolvers.test.ts @@ -51,7 +51,6 @@ describe('User type resolvers', () => { username: 'tamim.iqlbal', mobile: '+8801711111111', email: 'test@test.org', - identifiers: [{ system: 'NATIONAL_ID', value: '1010101010' }], systemRole: 'REGISTRATION_AGENT', scope: ['certify'], status: 'active', @@ -90,13 +89,6 @@ describe('User type resolvers', () => { const res = userTypeResolvers.User!.underInvestigation(mockResponse) expect(res).toBeTruthy() }) - it('return user identifier', () => { - const res = userTypeResolvers.User!.identifier(mockResponse) - expect(res).toEqual({ - system: mockResponse.identifiers[0].system, - value: mockResponse.identifiers[0].value - }) - }) it('return primaryOffice type', async () => { const mockOffice = { resourceType: 'Location', diff --git a/packages/gateway/src/features/user/type-resolvers.ts b/packages/gateway/src/features/user/type-resolvers.ts index 20d222b96b7..854552168e8 100644 --- a/packages/gateway/src/features/user/type-resolvers.ts +++ b/packages/gateway/src/features/user/type-resolvers.ts @@ -11,12 +11,7 @@ import { IAuthHeader, UUID } from '@opencrvs/commons' -import { - GQLIdentifier, - GQLResolver, - GQLSignatureInput, - GQLUserIdentifierInput -} from '@gateway/graphql/schema' +import { GQLResolver, GQLSignatureInput } from '@gateway/graphql/schema' import { Bundle, Extension, @@ -67,7 +62,6 @@ export interface IUserModelData { creationDate?: string practitionerId: string primaryOfficeId: string - identifiers: GQLIdentifier[] device: string auditHistory?: IAuditHistory[] avatar?: IAvatar @@ -100,7 +94,6 @@ export interface IUserPayload '_id' | 'status' | 'practitionerId' | 'username' | 'identifiers' | 'role' > { id?: string - identifiers: GQLUserIdentifierInput[] systemRole: string status?: string username?: string @@ -178,9 +171,6 @@ export const userTypeResolvers: GQLResolver = { 'SUSPICIOUS' ) }, - identifier(userModel: IUserModelData) { - return userModel.identifiers && userModel.identifiers[0] - }, email(userModel: IUserModelData) { return userModel.emailForNotification }, diff --git a/packages/migration/src/migrations/user-mgnt/20241007100507-remove-nid-field.ts b/packages/migration/src/migrations/user-mgnt/20241007100507-remove-nid-field.ts new file mode 100644 index 00000000000..3b3f1a7f6a6 --- /dev/null +++ b/packages/migration/src/migrations/user-mgnt/20241007100507-remove-nid-field.ts @@ -0,0 +1,42 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * OpenCRVS is also distributed under the terms of the Civil Registration + * & Healthcare Disclaimer located at http://opencrvs.org/license. + * + * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. + */ + +import { Db, MongoClient } from 'mongodb' + +export const up = async (db: Db, client: MongoClient) => { + // Add migration logic for applying changes to the database + // This code will be executed when running the migration + // It can include creating collections, modifying documents, etc. + const session = client.startSession() + try { + await db.collection('users').updateMany( + { identifiers: { $exists: true } }, // Only affect documents that have the identifiers field + { $unset: { identifiers: '' } } // Remove the identifiers field + ) + } finally { + await session.endSession() + } +} + +export const down = async (db: Db, client: MongoClient) => { + // Add migration logic for reverting changes made by the up() function + // This code will be executed when rolling back the migration + // It should reverse the changes made in the up() function + const session = client.startSession() + try { + await db.collection('users').updateMany( + { identifiers: { $exists: false } }, // Only affect documents that no longer have the identifiers field + { $set: { identifiers: [] } } // Re-add identifiers as an empty array + ) + } finally { + await session.endSession() + } +} diff --git a/packages/user-mgnt/src/features/activateUser/handler.test.ts b/packages/user-mgnt/src/features/activateUser/handler.test.ts index 2f22b550763..1e8ba1b5430 100644 --- a/packages/user-mgnt/src/features/activateUser/handler.test.ts +++ b/packages/user-mgnt/src/features/activateUser/handler.test.ts @@ -41,7 +41,6 @@ const mockUser: IUser & { _id: string } = { } ], username: 'j.doe1', - identifiers: [{ system: 'NID', value: '1234' }], email: 'j.doe@gmail.com', mobile: '+880123445568', systemRole: 'LOCAL_REGISTRAR', diff --git a/packages/user-mgnt/src/features/changeAvatar/handler.test.ts b/packages/user-mgnt/src/features/changeAvatar/handler.test.ts index 98cf15f44d8..d9fb82ca8f7 100644 --- a/packages/user-mgnt/src/features/changeAvatar/handler.test.ts +++ b/packages/user-mgnt/src/features/changeAvatar/handler.test.ts @@ -37,7 +37,6 @@ const mockUser: Partial = { } ], username: 'j.doe1', - identifiers: [{ system: 'NID', value: '1234' }], email: 'j.doe@gmail.com', mobile: '+880123445568', systemRole: 'LOCAL_REGISTRAR', diff --git a/packages/user-mgnt/src/features/changeEmail/handler.test.ts b/packages/user-mgnt/src/features/changeEmail/handler.test.ts index ccd93b80e2b..333137c7aae 100644 --- a/packages/user-mgnt/src/features/changeEmail/handler.test.ts +++ b/packages/user-mgnt/src/features/changeEmail/handler.test.ts @@ -37,7 +37,6 @@ const mockUser: Partial = { } ], username: 'j.doe1', - identifiers: [{ system: 'NID', value: '1234' }], email: 'j.doe@gmail.com', mobile: '+880123445568', systemRole: 'LOCAL_REGISTRAR', diff --git a/packages/user-mgnt/src/features/changePassword/handler.test.ts b/packages/user-mgnt/src/features/changePassword/handler.test.ts index a69e09e35c3..c38155aefba 100644 --- a/packages/user-mgnt/src/features/changePassword/handler.test.ts +++ b/packages/user-mgnt/src/features/changePassword/handler.test.ts @@ -37,7 +37,6 @@ const mockUser: Partial = { } ], username: 'j.doe1', - identifiers: [{ system: 'NID', value: '1234' }], email: 'j.doe@gmail.com', mobile: '+880123445568', systemRole: 'LOCAL_REGISTRAR', @@ -59,7 +58,6 @@ const mockExistingUser: Partial = { } ], username: 'j.doe1', - identifiers: [{ system: 'NID', value: '1234' }], email: 'j.doe@gmail.com', mobile: '+880123445568', systemRole: 'LOCAL_REGISTRAR', diff --git a/packages/user-mgnt/src/features/changePhone/handler.test.ts b/packages/user-mgnt/src/features/changePhone/handler.test.ts index 49a7becf1ad..51c34e73c14 100644 --- a/packages/user-mgnt/src/features/changePhone/handler.test.ts +++ b/packages/user-mgnt/src/features/changePhone/handler.test.ts @@ -37,7 +37,6 @@ const mockUser: Partial = { } ], username: 'j.doe1', - identifiers: [{ system: 'NID', value: '1234' }], email: 'j.doe@gmail.com', mobile: '+880123445568', systemRole: 'LOCAL_REGISTRAR', diff --git a/packages/user-mgnt/src/features/createUser/handler.test.ts b/packages/user-mgnt/src/features/createUser/handler.test.ts index 12ee4a432c2..980f00ea2c0 100644 --- a/packages/user-mgnt/src/features/createUser/handler.test.ts +++ b/packages/user-mgnt/src/features/createUser/handler.test.ts @@ -37,7 +37,6 @@ const mockUser = { } ], username: 'j.doe1', - identifiers: [{ system: 'NID', value: '1234' }], email: 'j.doe@gmail.com', mobile: '+880123445568', systemRole: 'LOCAL_REGISTRAR', @@ -112,7 +111,6 @@ describe('createUser handler', () => { } ], username: 'j.doe1', - identifiers: [{ system: 'NID', value: '1234' }], emailForNotification: 'j.doe@gmail.com', mobile: '+880123445568', systemRole: 'FIELD_AGENT', @@ -128,7 +126,6 @@ describe('createUser handler', () => { const expectedPractitioner = { resourceType: 'Practitioner', - identifier: [{ system: 'NID', value: '1234' }], telecom: [ { system: 'phone', value: '+880123445568' }, { system: 'email', value: 'j.doe@gmail.com' } diff --git a/packages/user-mgnt/src/features/createUser/service.ts b/packages/user-mgnt/src/features/createUser/service.ts index e59930be6cf..deae46753a0 100644 --- a/packages/user-mgnt/src/features/createUser/service.ts +++ b/packages/user-mgnt/src/features/createUser/service.ts @@ -36,7 +36,6 @@ export const createFhirPractitioner = ( if (system) { return { resourceType: 'Practitioner', - identifier: user.identifiers, telecom: [ { system: 'phone', value: user.mobile }, { system: 'email', value: user.emailForNotification } @@ -52,7 +51,6 @@ export const createFhirPractitioner = ( } else { return { resourceType: 'Practitioner', - identifier: user.identifiers, telecom: [ { system: 'phone', value: user.mobile }, { system: 'email', value: user.emailForNotification } diff --git a/packages/user-mgnt/src/features/resendInvite/handler.test.ts b/packages/user-mgnt/src/features/resendInvite/handler.test.ts index 1fd82e3240f..f05f5d79c9f 100644 --- a/packages/user-mgnt/src/features/resendInvite/handler.test.ts +++ b/packages/user-mgnt/src/features/resendInvite/handler.test.ts @@ -35,7 +35,6 @@ const mockUser: IUser & { _id: string } = { } ], username: 'j.doe1', - identifiers: [{ system: 'NID', value: '1234' }], email: 'j.doe@gmail.com', mobile: '+8801234567890', systemRole: 'LOCAL_REGISTRAR', diff --git a/packages/user-mgnt/src/features/resetPassword/handler.test.ts b/packages/user-mgnt/src/features/resetPassword/handler.test.ts index e5db9eab811..3ae6c1abb04 100644 --- a/packages/user-mgnt/src/features/resetPassword/handler.test.ts +++ b/packages/user-mgnt/src/features/resetPassword/handler.test.ts @@ -35,7 +35,6 @@ const mockUser: IUser & { _id: string } = { } ], username: 'j.doe1', - identifiers: [{ system: 'NID', value: '1234' }], email: 'j.doe@gmail.com', mobile: '+8801234567890', systemRole: 'LOCAL_REGISTRAR', diff --git a/packages/user-mgnt/src/features/updateUser/handler.test.ts b/packages/user-mgnt/src/features/updateUser/handler.test.ts index ae2b0daa823..e97929231e8 100644 --- a/packages/user-mgnt/src/features/updateUser/handler.test.ts +++ b/packages/user-mgnt/src/features/updateUser/handler.test.ts @@ -37,7 +37,6 @@ const mockUser = { } ], username: 'jw.doe', - identifiers: [{ system: 'NID', value: '1234' }], email: 'j.doe@gmail.com', mobile: '+880123445568', systemRole: 'LOCAL_REGISTRAR', @@ -193,7 +192,6 @@ describe('updateUser handler', () => { family: 'Doe' } ], - identifiers: [{ system: 'NID', value: '1234' }], email: 'j.doe@gmail.com', mobile: '+880123445568', systemRole: 'REGISTRATION_AGENT', @@ -237,7 +235,6 @@ describe('updateUser handler', () => { family: 'Doe' } ], - identifiers: [{ system: 'NID', value: '1234' }], email: 'j.doe@gmail.com', mobile: '+880123111111', systemRole: 'FIELD_AGENT', @@ -352,7 +349,6 @@ describe('updateUser handler', () => { family: 'Doe' } ], - identifiers: [{ system: 'NID', value: '1234' }], email: 'j.doe@gmail.com', mobile: '+880123445568', systemRole: 'FIELD_AGENT', diff --git a/packages/user-mgnt/src/features/updateUser/handler.ts b/packages/user-mgnt/src/features/updateUser/handler.ts index 3358814cf4c..5b9632cb941 100644 --- a/packages/user-mgnt/src/features/updateUser/handler.ts +++ b/packages/user-mgnt/src/features/updateUser/handler.ts @@ -63,7 +63,6 @@ export default async function updateUser( } // Update existing user's fields existingUser.name = user.name - existingUser.identifiers = user.identifiers existingUser.email = user.email existingUser.mobile = user.mobile existingUser.emailForNotification = user.emailForNotification diff --git a/packages/user-mgnt/src/features/userAudit/handler.test.ts b/packages/user-mgnt/src/features/userAudit/handler.test.ts index cef3eb73879..7e51618de40 100644 --- a/packages/user-mgnt/src/features/userAudit/handler.test.ts +++ b/packages/user-mgnt/src/features/userAudit/handler.test.ts @@ -39,7 +39,6 @@ const mockUser: IUser & { _id: string } = { } ], username: 'j.doe1', - identifiers: [{ system: 'NID', value: '1234' }], email: 'j.doe@gmail.com', mobile: '+880123445568', systemRole: 'LOCAL_REGISTRAR', diff --git a/packages/user-mgnt/src/features/userSearchRecord/handler.test.ts b/packages/user-mgnt/src/features/userSearchRecord/handler.test.ts index fe7c3e2b437..c4ea1c4c584 100644 --- a/packages/user-mgnt/src/features/userSearchRecord/handler.test.ts +++ b/packages/user-mgnt/src/features/userSearchRecord/handler.test.ts @@ -38,7 +38,6 @@ const mockUser: IUser & { _id: string } = { } ], username: 'j.doe1', - identifiers: [{ system: 'NID', value: '1234' }], email: 'j.doe@gmail.com', mobile: '+880123445568', systemRole: 'LOCAL_REGISTRAR', diff --git a/packages/user-mgnt/src/features/usernameSMSReminderInvite/handler.test.ts b/packages/user-mgnt/src/features/usernameSMSReminderInvite/handler.test.ts index b5032c3e273..629c4b9cff5 100644 --- a/packages/user-mgnt/src/features/usernameSMSReminderInvite/handler.test.ts +++ b/packages/user-mgnt/src/features/usernameSMSReminderInvite/handler.test.ts @@ -35,7 +35,6 @@ const mockUser: IUser & { _id: string } = { } ], username: 'j.doe1', - identifiers: [{ system: 'NID', value: '1234' }], email: 'j.doe@gmail.com', mobile: '+8801234567890', systemRole: 'LOCAL_REGISTRAR', diff --git a/packages/user-mgnt/src/features/verifyPassword/handler.test.ts b/packages/user-mgnt/src/features/verifyPassword/handler.test.ts index 3ef14078105..a7931378697 100644 --- a/packages/user-mgnt/src/features/verifyPassword/handler.test.ts +++ b/packages/user-mgnt/src/features/verifyPassword/handler.test.ts @@ -22,7 +22,6 @@ const mockUser: Partial = { } ], username: 'j.doe1', - identifiers: [{ system: 'NID', value: '1234' }], email: 'j.doe@gmail.com', mobile: '+880123445568', systemRole: 'LOCAL_REGISTRAR', diff --git a/packages/user-mgnt/src/features/verifySecurityAnswer/handler.test.ts b/packages/user-mgnt/src/features/verifySecurityAnswer/handler.test.ts index 45699d705e1..5a8b7ccfcc7 100644 --- a/packages/user-mgnt/src/features/verifySecurityAnswer/handler.test.ts +++ b/packages/user-mgnt/src/features/verifySecurityAnswer/handler.test.ts @@ -27,7 +27,6 @@ const mockUser: Partial = { } ], username: 'j.doe1', - identifiers: [{ system: 'NID', value: '1234' }], email: 'j.doe@gmail.com', mobile: '+880123445568', systemRole: 'LOCAL_REGISTRAR', diff --git a/packages/user-mgnt/src/model/user.ts b/packages/user-mgnt/src/model/user.ts index 2acc3009483..3b9fbdd1e8c 100644 --- a/packages/user-mgnt/src/model/user.ts +++ b/packages/user-mgnt/src/model/user.ts @@ -36,11 +36,6 @@ export interface IUserName { family: string given: string[] } - -interface IIdentifier { - system: string - value: string -} export interface ISecurityQuestionAnswer { questionKey: string answerHash: string @@ -132,7 +127,6 @@ export interface IAvatar { export interface IUser { name: IUserName[] username: string - identifiers: IIdentifier[] email: string mobile?: string emailForNotification?: string