Skip to content

Commit

Permalink
Merge pull request #1210 from opencrvs/merge-cc-to-develop
Browse files Browse the repository at this point in the history
Merge cc to develop
  • Loading branch information
Zangetsu101 authored Jan 23, 2025
2 parents 3469655 + 1ade8e5 commit 9f91881
Show file tree
Hide file tree
Showing 26 changed files with 905 additions and 172 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,27 @@

## 1.7.0 Release candidate

### Migration notes
In order to make the upgrade easier, there are a couple of steps that need to be performed which will make the codebase ready for the upgrade:
- Run this command from the root of the countryconfig repository ```curl https://raw.githubusercontent.com/opencrvs/opencrvs-countryconfig/configurable-roles/src/upgrade-to-1_7.ts | npx ts-node -T --cwd ./src```

It will remove `roles.csv` and generate a `roles.ts` file. It will also update the corresponding role column in `default-employees.csv` & `prod-employees.csv` while adding the corresponding translations in `client.csv`. The employee files are only used when seeding new environments, if you already have a v1.6.x of OpenCRVS deployed, the data in the environment will automatically get migrated after deploying the upgrade. The changes in these two files are made to keep the roles in sync with your previously deployed environments, if any.
- After pulling in the v1.7.0 changes reject the changes incoming to `roles.ts`, `default-employees.csv` & `prod-employees.csv` files as we used the script above to auto-generate them.

The `roles.ts` file now defines all the roles available in the system. New roles can be added & existing roles can be customized by giving them different scopes.

*N.B. The default roles generated in the `roles.ts` file during migration should not be removed to maintain backwards compatibility*

### Breaking changes

- `INFORMANT_SIGNATURE` & `INFORMANT_SIGNATURE_REQUIRED` are now deprecated
- Existing implementations relying on database-stored SVGs need to be updated to use the new configuration-based approach. A migration needs to be run (defined in [migration](https://github.com/opencrvs/opencrvs-core/pull/7813/files#diff-e5472dec87399bb9f73f75ec379ceb6a32ca135bc01dd8d0eb8f7d7aaa0bc0b1)), and default certificate templates must be created for each event type, following the convention `${event}-certificate` as the certificate template ID.
- **Roles** The previous `roles.csv` file has been deprecated. It will get removed once you run `yarn upgrade:code` command after pulling in the v1.7 changes. The command automatically generates a `roles.json` file which can be used as a baseline to configure the roles as per your requirements.

### New features

- Update the translations for System user add/edit form, `Last name` to `User's surname` and `First name` to `User's first name` to make them less confusing for system users [#6830](https://github.com/opencrvs/opencrvs-core/issues/6830)
- **User scopes** Introduce granular scopes to grant specific permissions to a particular role. The specifics about the introduced scopes can be found here: *Link to scopes description file*
- **Refactored certificate handling:** SVGs are no longer stored in the database; streamlined configurations now include certificate details, and clients request SVGs directly via URLs.
- Add constant.humanName to allow countries to have custom ordering on their full name e.g. start with `lastName` or `firstName` [#6830](https://github.com/opencrvs/opencrvs-core/issues/6830)

Expand Down
12 changes: 6 additions & 6 deletions e2e/testcases/birth/1-birth-event-declaration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,10 @@ test.describe('1. Birth event declaration', () => {

/*
* Expected result: should
* - be navigated to "in-progress" tab
* - be navigated to "my-drafts" tab
* - find the declared birth event record on this page list with saved data
*/
await expect(page.locator('#content-name')).toHaveText('In progress')
await expect(page.locator('#content-name')).toHaveText('My drafts')
await expect(page.getByText(/seconds ago/)).toBeVisible()
})
})
Expand Down Expand Up @@ -483,13 +483,13 @@ test.describe('1. Birth event declaration', () => {
test('1.10.3 Click Confirm', async ({ page }) => {
await page.getByRole('button', { name: 'Confirm' }).click()
/*
* Expected result: should be navigated to "in-progress" tab but no draft will be saved
* Expected result: should be navigated to "my-drafts" tab but no draft will be saved
*/

await page.waitForTimeout(500) // This page renders twice at first

await expect(
page.locator('#content-name', { hasText: 'In progress' })
page.locator('#content-name', { hasText: 'My drafts' })
).toBeVisible()
await expect(page.getByText(/seconds ago/)).toBeHidden()
})
Expand Down Expand Up @@ -552,13 +552,13 @@ test.describe('1. Birth event declaration', () => {
await page.getByRole('button', { name: 'Confirm' }).click()

/*
* Expected result: should be navigated to "in-progress" tab but no draft will be saved
* Expected result: should be navigated to "my-drafts" tab but no draft will be saved
*/

await page.waitForTimeout(500) // This page renders twice at first

await expect(
page.locator('#content-name', { hasText: 'In progress' })
page.locator('#content-name', { hasText: 'My drafts' })
).toBeVisible()
await expect(page.getByText(/seconds ago/)).toBeHidden()
})
Expand Down
52 changes: 47 additions & 5 deletions e2e/testcases/birth/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,31 @@ export const GET_BIRTH_REGISTRATION_FOR_REVIEW = print(gql`
contactRelationship
contactPhoneNumber
contactEmail
assignment {
practitionerId
firstName
lastName
officeName
avatarURL
}
certificates {
hasShowedVerifiedDocument
certificateTemplateId
collector {
relationship
otherRelationship
name {
use
firstNames
familyName
}
telecom {
system
value
use
}
}
}
duplicates {
compositionId
trackingId
Expand Down Expand Up @@ -207,6 +232,7 @@ export const GET_BIRTH_REGISTRATION_FOR_REVIEW = print(gql`
requesterOther
noSupportingDocumentationRequired
hasShowedVerifiedDocument
certificateTemplateId
date
action
regStatus
Expand Down Expand Up @@ -250,13 +276,13 @@ export const GET_BIRTH_REGISTRATION_FOR_REVIEW = print(gql`
user {
id
role {
_id
labels {
lang
label
id
label {
id
defaultMessage
description
}
}
systemRole
name {
firstNames
familyName
Expand Down Expand Up @@ -295,6 +321,7 @@ export const GET_BIRTH_REGISTRATION_FOR_REVIEW = print(gql`
}
certificates {
hasShowedVerifiedDocument
certificateTemplateId
collector {
relationship
otherRelationship
Expand All @@ -309,6 +336,21 @@ export const GET_BIRTH_REGISTRATION_FOR_REVIEW = print(gql`
use
}
}
certifier {
name {
use
firstNames
familyName
}
role {
id
label {
id
defaultMessage
description
}
}
}
}
duplicateOf
potentialDuplicates
Expand Down
12 changes: 6 additions & 6 deletions e2e/testcases/death/1-death-event-declaration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,10 +406,10 @@ test.describe('1. Death event declaration', () => {

/*
* Expected result: should
* - be navigated to "in-progress" tab
* - be navigated to "my-drafts" tab
* - find the declared death event record on this page list with saved data
*/
await expect(page.locator('#content-name')).toHaveText('In progress')
await expect(page.locator('#content-name')).toHaveText('My drafts')
await expect(page.getByText(/seconds ago/)).toBeVisible()
})
})
Expand Down Expand Up @@ -463,13 +463,13 @@ test.describe('1. Death event declaration', () => {
test('1.10.3 Click Confirm', async ({ page }) => {
await page.getByRole('button', { name: 'Confirm' }).click()
/*
* Expected result: should be navigated to "in-progress" tab but no draft will be saved
* Expected result: should be navigated to "my-drafts" tab but no draft will be saved
*/

await page.waitForTimeout(500) // This page renders twice at first

await expect(
page.locator('#content-name', { hasText: 'In progress' })
page.locator('#content-name', { hasText: 'My drafts' })
).toBeVisible()
await expect(page.getByText(/seconds ago/)).toBeHidden()
})
Expand Down Expand Up @@ -532,13 +532,13 @@ test.describe('1. Death event declaration', () => {
await page.getByRole('button', { name: 'Confirm' }).click()

/*
* Expected result: should be navigated to "in-progress" tab but no draft will be saved
* Expected result: should be navigated to "my-drafts" tab but no draft will be saved
*/

await page.waitForTimeout(500) // This page renders twice at first

await expect(
page.locator('#content-name', { hasText: 'In progress' })
page.locator('#content-name', { hasText: 'My drafts' })
).toBeVisible()
await expect(page.getByText(/seconds ago/)).toBeHidden()
})
Expand Down
47 changes: 42 additions & 5 deletions e2e/testcases/death/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,24 @@ export const GET_DEATH_REGISTRATION_FOR_REVIEW = print(gql`
contactRelationship
contactPhoneNumber
contactEmail
certificates {
hasShowedVerifiedDocument
certificateTemplateId
collector {
relationship
otherRelationship
name {
use
firstNames
familyName
}
telecom {
system
value
use
}
}
}
duplicates {
compositionId
trackingId
Expand Down Expand Up @@ -287,7 +305,9 @@ export const GET_DEATH_REGISTRATION_FOR_REVIEW = print(gql`
}
otherReason
requester
requesterOther
hasShowedVerifiedDocument
certificateTemplateId
noSupportingDocumentationRequired
date
action
Expand Down Expand Up @@ -318,13 +338,14 @@ export const GET_DEATH_REGISTRATION_FOR_REVIEW = print(gql`
user {
id
role {
_id
labels {
lang
label
id
label {
id
defaultMessage
description
}
}
systemRole
name {
firstNames
familyName
Expand Down Expand Up @@ -363,6 +384,7 @@ export const GET_DEATH_REGISTRATION_FOR_REVIEW = print(gql`
}
certificates {
hasShowedVerifiedDocument
certificateTemplateId
collector {
relationship
otherRelationship
Expand All @@ -377,6 +399,21 @@ export const GET_DEATH_REGISTRATION_FOR_REVIEW = print(gql`
use
}
}
certifier {
name {
use
firstNames
familyName
}
role {
id
label {
id
defaultMessage
description
}
}
}
}
duplicateOf
potentialDuplicates
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"eslint": "^8.43.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"husky": "1.0.0-rc.13",
"inquirer": "^9.2.12",
"js-yaml": "^4.1.0",
Expand All @@ -67,7 +67,7 @@
"node-ssh": "^13.2.0",
"nodemon": "^2.0.22",
"pino-pretty": "^11.0.0",
"prettier": "^2.8.8",
"prettier": "^3.4.2",
"react-intl": "^6.4.3",
"vitest": "^2.1.2"
},
Expand All @@ -77,7 +77,7 @@
"@hapi/h2o2": "^9.1.0",
"@hapi/hapi": "^20.0.1",
"@hapi/inert": "^6.0.3",
"@opencrvs/toolkit": "0.0.17-events",
"@opencrvs/toolkit": "0.0.22-scopes",
"@types/chalk": "^2.2.0",
"@types/code": "^4.0.3",
"@types/csv2json": "^1.4.0",
Expand All @@ -88,7 +88,7 @@
"@types/jest": "^24.0.13",
"@types/jwt-decode": "^2.2.1",
"@types/lodash": "^4.14.117",
"@types/node": "^10.12.5",
"@types/node": "^18.19.1",
"@types/node-fetch": "^2.6.2",
"@types/nodemailer": "^6.4.14",
"@types/uuid": "^10.0.0",
Expand Down
8 changes: 4 additions & 4 deletions src/api/certificates/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export async function certificateHandler(request: Request, h: ResponseToolkit) {
},
{
id: 'death-certificate',
event: 'death' as Event.Death,
event: Event.Death,
label: {
id: 'certificates.death.certificate',
defaultMessage: 'Death Certificate',
Expand All @@ -117,7 +117,7 @@ export async function certificateHandler(request: Request, h: ResponseToolkit) {
},
{
id: 'death-certificate-certified-copy',
event: 'death' as Event.Death,
event: Event.Death,
label: {
id: 'certificates.death.certificate.copy',
defaultMessage: 'Death Certificate certified copy',
Expand All @@ -142,7 +142,7 @@ export async function certificateHandler(request: Request, h: ResponseToolkit) {
},
{
id: 'marriage-certificate',
event: 'marriage' as Event.Marriage,
event: Event.Marriage,
label: {
id: 'certificates.marriage.certificate',
defaultMessage: 'Marriage Certificate',
Expand All @@ -166,7 +166,7 @@ export async function certificateHandler(request: Request, h: ResponseToolkit) {
},
{
id: 'marriage-certificate-certified-copy',
event: 'marriage' as Event.Marriage,
event: Event.Marriage,
label: {
id: 'certificates.marriage.certificate.copy',
defaultMessage: 'Marriage Certificate certified copy',
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/api/certificates/source/birth-certificate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/api/certificates/source/death-certificate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9f91881

Please sign in to comment.