Skip to content

Commit

Permalink
Remove NID field from the user details form
Browse files Browse the repository at this point in the history
Remove the question that asks the user for a national ID number in this form as it is not required

#6830
  • Loading branch information
Siyasanga authored and Siyasanga Mtshokotsha committed Oct 9, 2024
1 parent 025b867 commit f6d446e
Show file tree
Hide file tree
Showing 12 changed files with 1 addition and 145 deletions.
24 changes: 0 additions & 24 deletions packages/client/src/forms/user/fieldDefinitions/createUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 0 additions & 5 deletions packages/client/src/i18n/messages/views/userForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
54 changes: 0 additions & 54 deletions packages/client/src/tests/forms.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
27 changes: 0 additions & 27 deletions packages/client/src/tests/util.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ const MOCK_USER: IUserModelData = {
}
],
username: 'd.bulaya',
identifiers: [],
email: '',
device: 'Samsung Galaxy S9',
emailForNotification: '[email protected]',
Expand Down
2 changes: 0 additions & 2 deletions packages/gateway/src/features/user/root-resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {
GQLHumanNameInput,
GQLResolver,
GQLSearchFieldAgentResponse,
GQLUserIdentifierInput,
GQLUserInput
} from '@gateway/graphql/schema'
import { logger, isBase64FileString } from '@opencrvs/commons'
Expand Down Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions packages/gateway/src/features/user/type-resolvers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ describe('User type resolvers', () => {
username: 'tamim.iqlbal',
mobile: '+8801711111111',
email: '[email protected]',
identifiers: [{ system: 'NATIONAL_ID', value: '1010101010' }],
systemRole: 'REGISTRATION_AGENT',
scope: ['certify'],
status: 'active',
Expand Down Expand Up @@ -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',
Expand Down
12 changes: 1 addition & 11 deletions packages/gateway/src/features/user/type-resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -67,7 +62,6 @@ export interface IUserModelData {
creationDate?: string
practitionerId: string
primaryOfficeId: string
identifiers: GQLIdentifier[]
device: string
auditHistory?: IAuditHistory[]
avatar?: IAvatar
Expand Down Expand Up @@ -100,7 +94,6 @@ export interface IUserPayload
'_id' | 'status' | 'practitionerId' | 'username' | 'identifiers' | 'role'
> {
id?: string
identifiers: GQLUserIdentifierInput[]
systemRole: string
status?: string
username?: string
Expand Down Expand Up @@ -178,9 +171,6 @@ export const userTypeResolvers: GQLResolver = {
'SUSPICIOUS'
)
},
identifier(userModel: IUserModelData) {
return userModel.identifiers && userModel.identifiers[0]
},
email(userModel: IUserModelData) {
return userModel.emailForNotification
},
Expand Down
2 changes: 0 additions & 2 deletions packages/user-mgnt/src/features/createUser/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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 }
Expand Down
4 changes: 0 additions & 4 deletions packages/user-mgnt/src/features/updateUser/handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ const mockUser = {
}
],
username: 'jw.doe',
identifiers: [{ system: 'NID', value: '1234' }],
email: '[email protected]',
mobile: '+880123445568',
systemRole: 'LOCAL_REGISTRAR',
Expand Down Expand Up @@ -193,7 +192,6 @@ describe('updateUser handler', () => {
family: 'Doe'
}
],
identifiers: [{ system: 'NID', value: '1234' }],
email: '[email protected]',
mobile: '+880123445568',
systemRole: 'REGISTRATION_AGENT',
Expand Down Expand Up @@ -237,7 +235,6 @@ describe('updateUser handler', () => {
family: 'Doe'
}
],
identifiers: [{ system: 'NID', value: '1234' }],
email: '[email protected]',
mobile: '+880123111111',
systemRole: 'FIELD_AGENT',
Expand Down Expand Up @@ -352,7 +349,6 @@ describe('updateUser handler', () => {
family: 'Doe'
}
],
identifiers: [{ system: 'NID', value: '1234' }],
email: '[email protected]',
mobile: '+880123445568',
systemRole: 'FIELD_AGENT',
Expand Down
1 change: 0 additions & 1 deletion packages/user-mgnt/src/features/updateUser/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions packages/user-mgnt/src/model/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ export interface IUserName {
family: string
given: string[]
}

interface IIdentifier {
system: string
value: string
}
export interface ISecurityQuestionAnswer {
questionKey: string
answerHash: string
Expand Down Expand Up @@ -132,7 +127,6 @@ export interface IAvatar {
export interface IUser {
name: IUserName[]
username: string
identifiers: IIdentifier[]
email: string
mobile?: string
emailForNotification?: string
Expand Down

0 comments on commit f6d446e

Please sign in to comment.