diff --git a/packages/client/src/forms/user/fieldDefinitions/createUser.ts b/packages/client/src/forms/user/fieldDefinitions/createUser.ts index 2fc6c9ee9db..51115564494 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 { @@ -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 b462767d00a..9d9c3c1887d 100644 --- a/packages/client/src/i18n/messages/views/userForm.ts +++ b/packages/client/src/i18n/messages/views/userForm.ts @@ -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..81437e72d29 100644 --- a/packages/client/src/tests/forms.json +++ b/packages/client/src/tests/forms.json @@ -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", @@ -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..4165ce75bd9 100644 --- a/packages/client/src/tests/util.tsx +++ b/packages/client/src/tests/util.tsx @@ -1665,33 +1665,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', 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/user-mgnt/src/features/createUser/service.ts b/packages/user-mgnt/src/features/createUser/service.ts index d83d93b29bf..5cb8c2e074f 100644 --- a/packages/user-mgnt/src/features/createUser/service.ts +++ b/packages/user-mgnt/src/features/createUser/service.ts @@ -37,7 +37,6 @@ export const createFhirPractitioner = ( if (system) { return { resourceType: 'Practitioner', - identifier: user.identifiers, telecom: [ { system: 'phone', value: user.mobile }, { system: 'email', value: user.emailForNotification } @@ -53,7 +52,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/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/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