Skip to content
Open
Show file tree
Hide file tree
Changes from 18 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
73 changes: 47 additions & 26 deletions packages/client/.storybook/default-request-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import {
footballClubMembershipEvent,
libraryMembershipEvent,
LocationType,
TestUserRole
TestUserRole,
Location
} from '@opencrvs/commons/client'
import { testDataGenerator } from '@client/tests/test-data-generators'

Expand All @@ -55,162 +56,182 @@ const tRPCMsw = createTRPCMsw<AppRouter>({
transformer: { input: superjson, output: superjson }
})

export const V2_DEFAULT_MOCK_LOCATIONS = [
export const V2_DEFAULT_MOCK_LOCATIONS: Location[] = [
{
id: 'a45b982a-5c7b-4bd9-8fd8-a42d0994054c' as UUID,
name: 'Central',
locationType: LocationType.enum.ADMIN_STRUCTURE,
parentId: null,
validUntil: null
validUntil: null,
externalId: 'ydyJb1RAy4U1'
},
{
id: 'c599b691-fd2d-45e1-abf4-d185de727fb5' as UUID,
name: 'Sulaka',
locationType: LocationType.enum.ADMIN_STRUCTURE,
parentId: null,
validUntil: null
validUntil: null,
externalId: 'pQ8nGxWmZ2Q3'
},
{
id: '7ef2b9c7-5e6d-49f6-ae05-656207d0fc64' as UUID,
name: 'Pualula',
locationType: LocationType.enum.ADMIN_STRUCTURE,
parentId: null,
validUntil: null
validUntil: null,
externalId: 'Aq91DweLmT8k'
},
{
id: '6d1a59df-988c-4021-a846-ccbc021931a7' as UUID,
name: 'Chuminga',
locationType: LocationType.enum.ADMIN_STRUCTURE,
parentId: null,
validUntil: null
validUntil: null,
externalId: 'Rw0fYNh2Xk9a'
},
{
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
validUntil: null,
externalId: 'k7DsP4vbN1Qe'
},
{
// @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
validUntil: null,
externalId: 'Gm3Z9eQpHw4L'
},
{
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
validUntil: null,
externalId: 'sT0xVu1KqJ7r'
},
{
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
validUntil: null,
externalId: 'Nq6Bv2HpL9Te'
},
{
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
validUntil: null,
externalId: 'xK8cQ0ZRy5Wd'
},
{
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
validUntil: null,
externalId: 'M1nFr8LbC2Qy'
},
{
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
validUntil: null,
externalId: 'bT7pV6YrW0Xc'
},
{
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
validUntil: null,
externalId: 'zE4qPn2SgJ5d'
},
{
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
validUntil: null,
externalId: 'H8vDs1MqR4Uf'
},
{
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
validUntil: null,
externalId: 'Qw3uZ9KfX6Lm'
},
{
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
validUntil: null,
externalId: 'Yr0pCg8LdM2s'
},
{
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
validUntil: null,
externalId: 'tS9gJ4PwB1Qx'
},
{
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
validUntil: null,
externalId: 'Ld7Qm3XsA8Vr'
},
{
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
validUntil: null,
externalId: 'kF2sW9DmH0Bt'
},
{
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
validUntil: null,
externalId: 'Ue5Xb3VaC7Pq'
},
{
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
validUntil: null,
externalId: 'Pz8Kc1TqH6Jn'
},
{
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
validUntil: null,
externalId: 'Sm4Nw7GrD2Vy'
},
{
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
validUntil: null,
externalId: 'Vg1Bq5XeH9Lt'
}
]

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()
})
})
2 changes: 1 addition & 1 deletion packages/client/src/components/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class Component extends React.Component<IFullProps> {
children
} = this.props

if (offlineDataLoaded && initialDeclarationsLoaded && registerFormLoaded) {
if (offlineDataLoaded && initialDeclarationsLoaded) {
return (
<div id="readyDeclaration">
<StyledPage {...this.props}>{children}</StyledPage>
Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/i18n/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ export const intlReducer: LoopReducer<IntlState, any> = (
)

const languagesWithLocations = formatLocationLanguageState(
Object.values(action.payload.locations),
Object.values(action.payload.locations ?? []),
loadedLanguagesState
)

const languagesWithFacilities = formatLocationLanguageState(
Object.values(action.payload.facilities),
Object.values(action.payload.facilities ?? []),
languagesWithLocations
)

Expand Down
2 changes: 0 additions & 2 deletions packages/client/src/offline/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,6 @@ function delay(cmd: RunCmd<any>, time: number) {

function getDataLoadingCommands() {
return Cmd.list<actions.Action>([
FACILITIES_CMD,
LOCATIONS_CMD,
CONFIG_CMD,
CONDITIONALS_CMD,
VALIDATORS_CMD,
Expand Down
8 changes: 1 addition & 7 deletions packages/client/src/offline/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,7 @@ function getKey<K extends keyof IOfflineDataState>(store: IStoreState, key: K) {
export function isOfflineDataLoaded(
state: Partial<IOfflineData>
): state is IOfflineData {
const hasAllRequiredData =
state.facilities &&
state.locations &&
state.config &&
state.forms &&
state.templates &&
state.languages
const hasAllRequiredData = state.config && state.templates && state.languages

const isOfflineDataLoaded = Boolean(hasAllRequiredData)
if (isOfflineDataLoaded) merge(window.config, state.config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ export const persistenceMiddleware: Middleware<{}, IStoreState> =
userDetails.primaryOffice.id,
true
)
for (const query of queriesToPrefetch) {
client.query(query)
}
}
}
}
Loading
Loading