Skip to content

Commit

Permalink
chore: revert client changes to pass declarationLocationId
Browse files Browse the repository at this point in the history
  • Loading branch information
Nil20 committed Dec 4, 2024
1 parent d94227d commit babf055
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
2 changes: 2 additions & 0 deletions packages/client/src/ListSyncController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { client } from '@client/utils/apolloClient'
import { REGISTRATION_HOME_QUERY } from '@client/views/OfficeHome/queries'

export async function syncRegistrarWorkqueue(
locationId: string,
reviewStatuses: string[],
pageSize: number,
inProgressSkip: number,
Expand All @@ -27,6 +28,7 @@ export async function syncRegistrarWorkqueue(
const queryResult = await client.query({
query: REGISTRATION_HOME_QUERY,
variables: {
declarationLocationId: locationId,
pageSize,
reviewStatuses: reviewStatuses,
inProgressSkip: inProgressSkip,
Expand Down
29 changes: 24 additions & 5 deletions packages/client/src/views/OfficeHome/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const EVENT_SEARCH_RESULT_FIELDS = gql`
export const REGISTRATION_HOME_QUERY = gql`
${EVENT_SEARCH_RESULT_FIELDS}
query registrationHome(
$declarationLocationId: String!
$pageSize: Int
$inProgressSkip: Int
$healthSystemSkip: Int
Expand All @@ -89,6 +90,7 @@ export const REGISTRATION_HOME_QUERY = gql`
) {
inProgressTab: searchEvents(
advancedSearchParameters: {
declarationLocationId: $declarationLocationId
registrationStatuses: ["IN_PROGRESS"]
compositionType: [
"birth-declaration"
Expand All @@ -106,6 +108,7 @@ export const REGISTRATION_HOME_QUERY = gql`
}
notificationTab: searchEvents(
advancedSearchParameters: {
declarationLocationId: $declarationLocationId
registrationStatuses: ["IN_PROGRESS"]
compositionType: [
"birth-notification"
Expand All @@ -122,7 +125,10 @@ export const REGISTRATION_HOME_QUERY = gql`
}
}
reviewTab: searchEvents(
advancedSearchParameters: { registrationStatuses: $reviewStatuses }
advancedSearchParameters: {
declarationLocationId: $declarationLocationId
registrationStatuses: $reviewStatuses
}
count: $pageSize
skip: $reviewSkip
) {
Expand All @@ -132,7 +138,10 @@ export const REGISTRATION_HOME_QUERY = gql`
}
}
rejectTab: searchEvents(
advancedSearchParameters: { registrationStatuses: ["REJECTED"] }
advancedSearchParameters: {
declarationLocationId: $declarationLocationId
registrationStatuses: ["REJECTED"]
}
count: $pageSize
skip: $rejectSkip
sortColumn: "createdAt.keyword"
Expand All @@ -145,6 +154,7 @@ export const REGISTRATION_HOME_QUERY = gql`
}
approvalTab: searchEvents(
advancedSearchParameters: {
declarationLocationId: $declarationLocationId
registrationStatuses: ["VALIDATED", "CORRECTION_REQUESTED"]
}
count: $pageSize
Expand All @@ -156,7 +166,10 @@ export const REGISTRATION_HOME_QUERY = gql`
}
}
externalValidationTab: searchEvents(
advancedSearchParameters: { registrationStatuses: ["WAITING_VALIDATION"] }
advancedSearchParameters: {
declarationLocationId: $declarationLocationId
registrationStatuses: ["WAITING_VALIDATION"]
}
count: $pageSize
skip: $externalValidationSkip
) {
Expand All @@ -166,7 +179,10 @@ export const REGISTRATION_HOME_QUERY = gql`
}
}
printTab: searchEvents(
advancedSearchParameters: { registrationStatuses: ["REGISTERED"] }
advancedSearchParameters: {
declarationLocationId: $declarationLocationId
registrationStatuses: ["REGISTERED"]
}
count: $pageSize
skip: $printSkip
) {
Expand All @@ -176,7 +192,10 @@ export const REGISTRATION_HOME_QUERY = gql`
}
}
issueTab: searchEvents(
advancedSearchParameters: { registrationStatuses: ["CERTIFIED"] }
advancedSearchParameters: {
declarationLocationId: $declarationLocationId
registrationStatuses: ["CERTIFIED"]
}
count: $pageSize
skip: $issueSkip
) {
Expand Down
6 changes: 5 additions & 1 deletion packages/client/src/workqueue/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
} from '@client/declarations'
import { IStoreState } from '@client/store'
import { getUserDetails, getScope } from '@client/profile/profileSelectors'
import { UserDetails } from '@client/utils/userUtils'
import { getUserLocation, UserDetails } from '@client/utils/userUtils'
import { syncRegistrarWorkqueue } from '@client/ListSyncController'
import type {
GQLEventSearchResultSet,
Expand Down Expand Up @@ -348,6 +348,9 @@ async function getWorkqueueData(
userDetails: UserDetails,
workqueuePaginationParams: IWorkqueuePaginationParams
) {
const registrationLocationId =
(userDetails && getUserLocation(userDetails).id) || ''

const scope = getScope(state)!
const reviewStatuses =
scope && scope.includes(SCOPES.RECORD_REGISTER)
Expand All @@ -371,6 +374,7 @@ async function getWorkqueueData(
} = workqueuePaginationParams

const result = await syncRegistrarWorkqueue(
registrationLocationId,
reviewStatuses,
pageSize,
inProgressSkip,
Expand Down

0 comments on commit babf055

Please sign in to comment.