Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
e9a9df1
chore: remove v1 location endpoints from gateway
jamil314 Nov 21, 2025
9a6c288
fix: directly seed v2 db
jamil314 Nov 27, 2025
fa5cbca
Merge branch 'develop' into ocrvs-11067
jamil314 Nov 28, 2025
86af329
fix: remove restrict-unrestrict
jamil314 Nov 28, 2025
0b8f3e7
fix: events tests
jamil314 Nov 28, 2025
c7aaad6
fix: update V2_DEFAULT_MOCK_LOCATIONS to include externalId
jamil314 Nov 28, 2025
eeb0141
fix: update snapshot
jamil314 Nov 28, 2025
cace967
chore: remove location endpoints from config
jamil314 Nov 28, 2025
e6a3fe3
fix: remove craeteLocation from routes
jamil314 Nov 28, 2025
7ab6bbe
fix: extract externalId corrently while seeding user
jamil314 Nov 28, 2025
5f56c34
chore: remove unused export
jamil314 Nov 28, 2025
2ae48a1
docs: update changelog
jamil314 Nov 28, 2025
ca34702
chore: add toolkit as a dependency of data-seeder
jamil314 Nov 28, 2025
c854932
fix: fetch v2 location in user type resolver
jamil314 Dec 1, 2025
7c3b422
chore: remove v1 location prefetching from redux
jamil314 Dec 1, 2025
8bc3eaa
Merge branch 'develop' into ocrvs-11067
jamil314 Dec 1, 2025
a2dc35a
chore: remove v1 location tests
jamil314 Dec 2, 2025
072d6f1
Merge branch 'develop' into ocrvs-11067
jamil314 Dec 2, 2025
e5cae03
fix: use v2 locations in organisation and team pages
jamil314 Dec 2, 2025
66a2b44
fix: remove performance button and routes
jamil314 Dec 3, 2025
56194de
fix: types
jamil314 Dec 3, 2025
4180800
Merge branch 'ocrvs-11067' of https://github.com/opencrvs/opencrvs-co…
jamil314 Dec 3, 2025
3dde8bb
fix: types
jamil314 Dec 3, 2025
4a23b29
Merge branch 'develop' into ocrvs-11067
jamil314 Dec 3, 2025
7fcf254
fix: keep both v1 and v2 utils
jamil314 Dec 3, 2025
5e90996
fix: use v2 location utils
jamil314 Dec 4, 2025
6a28fb9
fix: LocationPicker and UserList tests
jamil314 Dec 4, 2025
66f91af
Merge branch 'develop' into ocrvs-11067
jamil314 Dec 4, 2025
0ede7d5
fix: addressName
jamil314 Dec 4, 2025
af1c389
fix: remove v1 tests
jamil314 Dec 4, 2025
055052d
Merge branch 'develop' into ocrvs-11067
jamil314 Dec 8, 2025
faa7d5c
fix: include externalId while seeding
jamil314 Dec 9, 2025
ae13720
chore: remove CompletenessRates test
Zangetsu101 Dec 9, 2025
e846263
test: mock useLocations globally in tests
Zangetsu101 Dec 9, 2025
482d44d
test: use v2 mock locations in AdministrativeLevels tests
Zangetsu101 Dec 9, 2025
87780c2
test: use original implementation of getLeafLocationIds
Zangetsu101 Dec 9, 2025
daf2a11
test: blur inputs to reduce flakiness
Zangetsu101 Dec 10, 2025
ffc02cf
chore: remove unused exports
Zangetsu101 Dec 10, 2025
768543f
Merge branch 'develop' into ocrvs-11067
Zangetsu101 Dec 10, 2025
692f954
test: restore deleted birth mock draft
Zangetsu101 Dec 10, 2025
10fcaaf
test: remove remaining unused exports
Zangetsu101 Dec 10, 2025
aa02c0b
Merge branch 'develop' into ocrvs-11067
Zangetsu101 Dec 10, 2025
ded763f
Merge branch 'develop' into ocrvs-11067
jamil314 Dec 12, 2025
80ff25f
feat: expose `getLocationHierarchy` through trpc
jamil314 Dec 12, 2025
114e426
fix: user creation flow
jamil314 Dec 12, 2025
96a5ce8
fix: add externalId
jamil314 Dec 12, 2025
9fa199f
Merge branch 'develop' into ocrvs-11067
jamil314 Dec 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

## 2.0.0 Release Candidate

### Breaking changes

- **Removed following endpoints from gateway:**
| Path | Method |
|--------------------|--------|
| `/location` | `*` |
| `/location/{id}` | `*` |
| `/locations` | `GET` |
| `/locations` | `POST` |
| `/locations/{id}` | `*` |

### New features

#### HTTP Input
Expand Down
2 changes: 1 addition & 1 deletion packages/client/.storybook/decorators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
} from '@opencrvs/commons/client'
import { testDataGenerator } from '@client/tests/test-data-generators'
import { getLeafLocationIds } from '@client/v2-events/hooks/useLocations'
import { V2_DEFAULT_MOCK_LOCATIONS_MAP } from '../.storybook/default-request-handlers'
import { V2_DEFAULT_MOCK_LOCATIONS_MAP } from '@client/tests/v2-events/locations-mock'

const generator = testDataGenerator()

Expand Down
167 changes: 3 additions & 164 deletions packages/client/.storybook/default-request-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ import {
footballClubMembershipEvent,
libraryMembershipEvent,
LocationType,
TestUserRole
TestUserRole,
Location
} from '@opencrvs/commons/client'
import { testDataGenerator } from '@client/tests/test-data-generators'
import { V2_DEFAULT_MOCK_LOCATIONS } from '@client/tests/v2-events/locations-mock'

async function ensureCacheExists(cacheName: string) {
const cacheNames = await caches.keys()
Expand All @@ -55,169 +57,6 @@ const tRPCMsw = createTRPCMsw<AppRouter>({
transformer: { input: superjson, output: superjson }
})

export const V2_DEFAULT_MOCK_LOCATIONS = [
{
id: 'a45b982a-5c7b-4bd9-8fd8-a42d0994054c' as UUID,
name: 'Central',
locationType: LocationType.enum.ADMIN_STRUCTURE,
parentId: null,
validUntil: null
},
{
id: 'c599b691-fd2d-45e1-abf4-d185de727fb5' as UUID,
name: 'Sulaka',
locationType: LocationType.enum.ADMIN_STRUCTURE,
parentId: null,
validUntil: null
},
{
id: '7ef2b9c7-5e6d-49f6-ae05-656207d0fc64' as UUID,
name: 'Pualula',
locationType: LocationType.enum.ADMIN_STRUCTURE,
parentId: null,
validUntil: null
},
{
id: '6d1a59df-988c-4021-a846-ccbc021931a7' as UUID,
name: 'Chuminga',
locationType: LocationType.enum.ADMIN_STRUCTURE,
parentId: null,
validUntil: null
},
{
id: '62a0ccb4-880d-4f30-8882-f256007dfff9' as UUID,
name: 'Ibombo',
locationType: LocationType.enum.ADMIN_STRUCTURE,
parentId: 'a45b982a-5c7b-4bd9-8fd8-a42d0994054c' as UUID,
validUntil: null
},
{
// @NOTE: This happens to map to a valid location in events test environment. Updating it will break tests.
// @TODO: Find a way to give out context aware mock values in the future.
id: '27160bbd-32d1-4625-812f-860226bfb92a' as UUID,
name: 'Isango',
locationType: LocationType.enum.ADMIN_STRUCTURE,
parentId: 'a45b982a-5c7b-4bd9-8fd8-a42d0994054c' as UUID,
validUntil: null
},
{
id: '967032fd-3f81-478a-826c-30cb8fe121bd' as UUID,
name: 'Isamba',
locationType: LocationType.enum.ADMIN_STRUCTURE,
parentId: 'a45b982a-5c7b-4bd9-8fd8-a42d0994054c' as UUID,
validUntil: null
},
{
id: '89a33893-b17d-481d-a26d-6461e7ac1651' as UUID,
name: 'Itambo',
locationType: LocationType.enum.ADMIN_STRUCTURE,
parentId: 'a45b982a-5c7b-4bd9-8fd8-a42d0994054c' as UUID,
validUntil: null
},
{
id: 'd42ab2fe-e7ed-470e-8b31-4fb27f9b8250' as UUID,
name: 'Ezhi',
locationType: LocationType.enum.ADMIN_STRUCTURE,
parentId: 'a45b982a-5c7b-4bd9-8fd8-a42d0994054c' as UUID,
validUntil: null
},
{
id: '423d000f-101b-47c0-8b86-21a908067cee' as UUID,
name: 'Chamakubi Health Post',
locationType: LocationType.enum.HEALTH_FACILITY,
parentId: '62a0ccb4-880d-4f30-8882-f256007dfff9' as UUID,
validUntil: null
},
{
id: '4d3279be-d026-420c-88f7-f0a4ae986973' as UUID,
name: 'Ibombo Rural Health Centre',
locationType: LocationType.enum.HEALTH_FACILITY,
parentId: '62a0ccb4-880d-4f30-8882-f256007dfff9' as UUID,
validUntil: null
},
{
id: '190902f4-1d77-476a-8947-41145af1db7d' as UUID,
name: 'Chikobo Rural Health Centre',
locationType: LocationType.enum.HEALTH_FACILITY,
parentId: '62a0ccb4-880d-4f30-8882-f256007dfff9' as UUID,
validUntil: null
},
{
id: 'f5ecbd9b-a01e-4a65-910e-70e86ab41b71' as UUID,
name: 'Chilochabalenje Health Post',
locationType: LocationType.enum.HEALTH_FACILITY,
parentId: '62a0ccb4-880d-4f30-8882-f256007dfff9' as UUID,
validUntil: null
},
{
id: 'dbfc178f-7295-4b90-b28d-111c95b03127' as UUID,
name: 'Chipeso Rural Health Centre',
locationType: LocationType.enum.HEALTH_FACILITY,
parentId: '62a0ccb4-880d-4f30-8882-f256007dfff9' as UUID,
validUntil: null
},
{
id: '09862bfe-c7ac-46cd-987b-668681533c80' as UUID,
name: 'Chisamba Rural Health Centre',
locationType: LocationType.enum.HEALTH_FACILITY,
parentId: '62a0ccb4-880d-4f30-8882-f256007dfff9' as UUID,
validUntil: null
},
{
id: '834ce389-e95b-4fb0-96a0-33e9ab323059' as UUID,
name: 'Chitanda Rural Health Centre',
locationType: LocationType.enum.HEALTH_FACILITY,
parentId: '62a0ccb4-880d-4f30-8882-f256007dfff9' as UUID,
validUntil: null
},
{
id: '0431c433-6062-4a4c-aee9-25271aec61ee' as UUID,
name: 'Golden Valley Rural Health Centre',
locationType: LocationType.enum.HEALTH_FACILITY,
parentId: '62a0ccb4-880d-4f30-8882-f256007dfff9' as UUID,
validUntil: null
},
{
id: 'bc84d0b6-7ba7-480d-a339-5d9920d90eb2' as UUID,
name: 'Ipongo Rural Health Centre',
locationType: LocationType.enum.HEALTH_FACILITY,
parentId: '62a0ccb4-880d-4f30-8882-f256007dfff9' as UUID,
validUntil: null
},
{
id: '4cf1f53b-b730-41d2-8649-dff7eeed970d' as UUID,
name: 'Itumbwe Health Post',
locationType: LocationType.enum.HEALTH_FACILITY,
parentId: '62a0ccb4-880d-4f30-8882-f256007dfff9' as UUID,
validUntil: null
},
{
id: '4b3676cb-9355-4942-9eb9-2ce46acaf0e0' as UUID,
name: 'Kabangalala Rural Health Centre',
locationType: LocationType.enum.HEALTH_FACILITY,
parentId: '62a0ccb4-880d-4f30-8882-f256007dfff9' as UUID,
validUntil: null
},
{
id: '028d2c85-ca31-426d-b5d1-2cef545a4902' as UUID,
name: 'Ibombo District Office',
locationType: LocationType.enum.CRVS_OFFICE,
parentId: '62a0ccb4-880d-4f30-8882-f256007dfff9' as UUID,
validUntil: null
},
{
id: '62a0ccb4-4f30-4f30-8882-f256007dff9f' as UUID,
name: 'Isamba District Office',
locationType: LocationType.enum.CRVS_OFFICE,
parentId: '967032fd-3f81-478a-826c-30cb8fe121bd' as UUID,
validUntil: null
}
]

export const V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
)

export const handlers = {
drafts: [
tRPCMsw.event.draft.list.query(() => {
Expand Down
13 changes: 0 additions & 13 deletions packages/client/src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { createTestApp, flushPromises, getItem } from '@client/tests/util'
import * as actions from '@client/notification/actions'
import { AppStore } from '@client/store'
import { createClient } from '@client/utils/apolloClient'
import { referenceApi } from '@client/utils/referenceApi'
import { ReactWrapper } from 'enzyme'
import { vi } from 'vitest'
import { waitFor } from './tests/wait-for-element'
Expand Down Expand Up @@ -110,16 +109,4 @@ describe('when user has a valid token in local storage', () => {
await flushPromises()
expect(assign.mock.calls).toHaveLength(0)
})

it('loads languages, facilities and locations on startup', async () => {
const loadFacilities = vi.spyOn(referenceApi, 'loadFacilities')
const loadContent = vi.spyOn(referenceApi, 'loadContent')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

content test might still have value?

const loadLocations = vi.spyOn(referenceApi, 'loadLocations')

createTestApp()
await flushPromises()
expect(loadFacilities).toHaveBeenCalled()
expect(loadContent).toHaveBeenCalled()
expect(loadLocations).toHaveBeenCalled()
})
})
65 changes: 41 additions & 24 deletions packages/client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import { UserList } from './views/SysAdmin/Team/user/UserList'
import VSExport from './views/SysAdmin/Vsexports/VSExport'
import { UserAudit } from './views/UserAudit/UserAudit'
import { config } from './config'
import { TRPCProvider } from './v2-events/trpc'

// Injecting global styles for the body tag - used only once
const GlobalStyle = createGlobalStyle`
Expand Down Expand Up @@ -299,14 +300,6 @@ export const routesConfig = turnOffV2Events
path: routes.PERFORMANCE_FIELD_AGENT_LIST,
element: <FieldAgentList />
},
{
path: routes.PERFORMANCE_HOME,
element: (
<ProtectedRoute scopes={[SCOPES.PERFORMANCE_READ]}>
<PerformanceHome />
</ProtectedRoute>
)
},
{
path: routes.EVENT_COMPLETENESS_RATES,
element: <CompletenessRates />
Expand All @@ -331,19 +324,35 @@ export const routesConfig = turnOffV2Events
},
{
path: routes.CREATE_USER_ON_LOCATION,
element: <CreateNewUser />
element: (
<TRPCProvider>
<CreateNewUser />
</TRPCProvider>
)
},
{
path: routes.CREATE_USER_SECTION,
element: <CreateNewUser />
element: (
<TRPCProvider>
<CreateNewUser />
</TRPCProvider>
)
},
{
path: routes.REVIEW_USER_FORM,
element: <CreateNewUser />
element: (
<TRPCProvider>
<CreateNewUser />
</TRPCProvider>
)
},
{
path: routes.REVIEW_USER_DETAILS,
element: <CreateNewUser />
element: (
<TRPCProvider>
<CreateNewUser />
</TRPCProvider>
)
}
]
}
Expand Down Expand Up @@ -399,14 +408,6 @@ export const routesConfig = turnOffV2Events
path: routes.PERFORMANCE_FIELD_AGENT_LIST,
element: <FieldAgentList />
},
{
path: routes.PERFORMANCE_HOME,
element: (
<ProtectedRoute scopes={[SCOPES.PERFORMANCE_READ]}>
<PerformanceHome />
</ProtectedRoute>
)
},
{
path: routes.EVENT_COMPLETENESS_RATES,
element: <CompletenessRates />
Expand All @@ -431,19 +432,35 @@ export const routesConfig = turnOffV2Events
},
{
path: routes.CREATE_USER_ON_LOCATION,
element: <CreateNewUser />
element: (
<TRPCProvider>
<CreateNewUser />
</TRPCProvider>
)
},
{
path: routes.CREATE_USER_SECTION,
element: <CreateNewUser />
element: (
<TRPCProvider>
<CreateNewUser />
</TRPCProvider>
)
},
{
path: routes.REVIEW_USER_FORM,
element: <CreateNewUser />
element: (
<TRPCProvider>
<CreateNewUser />
</TRPCProvider>
)
},
{
path: routes.REVIEW_USER_DETAILS,
element: <CreateNewUser />
element: (
<TRPCProvider>
<CreateNewUser />
</TRPCProvider>
)
}
]
}
Expand Down
7 changes: 4 additions & 3 deletions packages/client/src/components/LocationPicker.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
*
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
*/

import { vi, beforeEach, afterEach, describe, it, expect } from 'vitest'
import { AppStore, createStore } from '@client/store'
import { createTestComponent, flushPromises } from '@client/tests/util'
import { waitForElement } from '@client/tests/wait-for-element'
import { ReactWrapper } from 'enzyme'
import React from 'react'
import { vi } from 'vitest'
import { LocationPicker } from './LocationPicker'

describe('location picker tests', () => {
Expand All @@ -29,7 +30,7 @@ describe('location picker tests', () => {
beforeEach(async () => {
const { component: testComponent } = await createTestComponent(
<LocationPicker
selectedLocationId="bfe8306c-0910-48fe-8bf5-0db906cf3155"
selectedLocationId="028d2c85-ca31-426d-b5d1-2cef545a4902"
onChangeLocation={onChangeLocationMock}
/>,
{ store },
Expand All @@ -48,7 +49,7 @@ describe('location picker tests', () => {
'#location-range-picker-action'
)

expect(actionElement.hostNodes().text()).toBe('Baniajan Union')
expect(actionElement.hostNodes().text()).toBe('Ibombo District Office')
})

it('focuses input on click action', async () => {
Expand Down
Loading
Loading