Skip to content

Commit

Permalink
chore: configurable roles tasks (#7645)
Browse files Browse the repository at this point in the history
* chore!: amend migration to update role in related person entry

* Revert "chore!: amend migration to update role in related person entry"

This reverts commit 595621c.

* chore: add certifier field for querying certificate property

* chore: save and get practitioner info for certified records

* chore: clean up schema comments

* chore: update record audit modal to show print in advance data

* chore: show user role for certifier in audit

* chore: use User instead of Practitioner for certifier

* fix: amend reading tasks for certifier

* chore: add experimental migration for doc ref

* chore: update gateway schema to latest develop changes

* chore: update client queries for role

* chore: revert migration changes deleting patient entries

* chore: update audit modal to show previous values of certified records

* fix: amend role types

* fix: clean up console

* chore: amend review changes

* chore: refactor fetching role
  • Loading branch information
Nil20 authored Oct 3, 2024
1 parent 6fa09a3 commit dceb82b
Show file tree
Hide file tree
Showing 22 changed files with 515 additions and 534 deletions.
255 changes: 28 additions & 227 deletions packages/client/graphql.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3569,6 +3569,18 @@
"name": "Certificate",
"description": null,
"fields": [
{
"name": "certifier",
"description": null,
"args": [],
"type": {
"kind": "OBJECT",
"name": "User",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "collector",
"description": null,
Expand Down Expand Up @@ -7268,8 +7280,8 @@
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "ENUM",
"name": "SystemRoleType",
"kind": "OBJECT",
"name": "UserRole",
"ofType": null
}
},
Expand Down Expand Up @@ -16813,174 +16825,6 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "Response",
"description": null,
"fields": [
{
"name": "roleIdMap",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Map",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "Role",
"description": null,
"fields": [
{
"name": "_id",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "labels",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "RoleLabel",
"ofType": null
}
}
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "INPUT_OBJECT",
"name": "RoleInput",
"description": null,
"fields": null,
"inputFields": [
{
"name": "_id",
"description": null,
"type": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "labels",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "INPUT_OBJECT",
"name": "LabelInput",
"ofType": null
}
}
}
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"interfaces": null,
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "RoleLabel",
"description": null,
"fields": [
{
"name": "label",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "lang",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "SearchFieldAgentResponse",
Expand Down Expand Up @@ -17663,59 +17507,6 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "ENUM",
"name": "SystemRoleType",
"description": null,
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": [
{
"name": "FIELD_AGENT",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "LOCAL_REGISTRAR",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "LOCAL_SYSTEM_ADMIN",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "NATIONAL_REGISTRAR",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "NATIONAL_SYSTEM_ADMIN",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "PERFORMANCE_MANAGEMENT",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REGISTRATION_AGENT",
"description": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "SystemSecret",
Expand Down Expand Up @@ -20422,7 +20213,11 @@
"name": "include",
"description": "Directs the executor to include this field or fragment only when the `if` argument is true.",
"isRepeatable": false,
"locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"],
"locations": [
"FIELD",
"FRAGMENT_SPREAD",
"INLINE_FRAGMENT"
],
"args": [
{
"name": "if",
Expand All @@ -20446,7 +20241,11 @@
"name": "skip",
"description": "Directs the executor to skip this field or fragment when the `if` argument is true.",
"isRepeatable": false,
"locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"],
"locations": [
"FIELD",
"FRAGMENT_SPREAD",
"INLINE_FRAGMENT"
],
"args": [
{
"name": "if",
Expand All @@ -20470,7 +20269,9 @@
"name": "specifiedBy",
"description": "Exposes a URL that specifies the behaviour of this scalar.",
"isRepeatable": false,
"locations": ["SCALAR"],
"locations": [
"SCALAR"
],
"args": [
{
"name": "url",
Expand All @@ -20492,4 +20293,4 @@
}
]
}
}
}
13 changes: 11 additions & 2 deletions packages/client/src/declarations/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
filterProcessingDeclarations,
filterProcessingDeclarationsFromQuery
} from '.'
import { Event, SystemRoleType, Status } from '@client/utils/gateway'
import { Event, Status } from '@client/utils/gateway'
import { AppStore, createStore } from '@client/store'
import { mockDeclarationData, flushPromises } from '@client/tests/util'
import { storage } from '@client/storage'
Expand Down Expand Up @@ -331,7 +331,16 @@ describe('archiveDeclaration tests', () => {
}
},
name: [],
localRegistrar: { name: [], role: 'FIELD_AGENT' as SystemRoleType }
localRegistrar: {
name: [],
role: {
label: {
defaultMessage: 'Field Agent',
description: 'Name for user role Field Agent',
id: 'userRole.fieldAgent'
}
}
}
}

indexedDB = {
Expand Down
8 changes: 7 additions & 1 deletion packages/client/src/profile/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ const FETCH_USER = gql`
firstNames
familyName
}
role
role {
label {
id
defaultMessage
description
}
}
signature {
data
type
Expand Down
18 changes: 15 additions & 3 deletions packages/client/src/tests/util.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
*/
import { App } from '@client/App'
import { Event, SystemRoleType, Status, Scope } from '@client/utils/gateway'
import { Event, Status, Scope } from '@client/utils/gateway'
import { UserDetails } from '@client/utils/userUtils'
import { getRegisterForm } from '@client/forms/register/declaration-selectors'
import { getReviewForm } from '@client/forms/register/review-selectors'
Expand Down Expand Up @@ -392,7 +392,13 @@ export const userDetails: UserDetails = {
status: 'active'
},
localRegistrar: {
role: 'LOCAL_REGISTRAR' as SystemRoleType,
role: {
label: {
defaultMessage: 'Local Registrar',
description: 'Name for user role Field Agent',
id: 'userRole.fieldAgent'
}
},
signature: {
data: `data:image/png;base64,${validImageB64String}`,
type: 'image/png'
Expand Down Expand Up @@ -1119,7 +1125,13 @@ export function loginAsFieldAgent(store: AppStore) {
familyName: 'Ashraful'
}
],
role: SystemRoleType.LocalRegistrar,
role: {
label: {
defaultMessage: 'Local Registrar',
description: 'Name for user role Field Agent',
id: 'userRole.fieldAgent'
}
},
signature: undefined
}
}
Expand Down
Loading

0 comments on commit dceb82b

Please sign in to comment.