From 333951f575b4360995b67ffbd86e57c8d963ee6a Mon Sep 17 00:00:00 2001 From: Onitoxan Date: Wed, 27 Nov 2024 11:36:59 +0100 Subject: [PATCH] Add flow test --- apps/hpc-ftsadmin-e2e/src/support/commands.ts | 36 + .../hpc-ftsadmin-e2e/src/tests/add-flow.cy.ts | 58 +- apps/hpc-ftsadmin/src/app/app.tsx | 1 + .../app/components/flow-form/flow-form.tsx | 75 +- .../app/components/flow-form/flow-search.tsx | 4 + .../flow-form/form-group-readonly.tsx | 20 +- .../src/app/components/reporting-detail.tsx | 11 +- .../hpc-ftsadmin/src/app/pages/flows/flow.tsx | 2 +- .../src/app/utils/ellipsis-text.tsx | 3 + apps/hpc-ftsadmin/src/i18n/langs/en.json | 4 +- libs/hpc-dummy/src/lib/data-types.ts | 12 + libs/hpc-dummy/src/lib/data.ts | 1446 ++++++++++++----- libs/hpc-dummy/src/lib/dummy.ts | 150 +- 13 files changed, 1358 insertions(+), 464 deletions(-) diff --git a/apps/hpc-ftsadmin-e2e/src/support/commands.ts b/apps/hpc-ftsadmin-e2e/src/support/commands.ts index 12f153039..bea671ca4 100644 --- a/apps/hpc-ftsadmin-e2e/src/support/commands.ts +++ b/apps/hpc-ftsadmin-e2e/src/support/commands.ts @@ -62,11 +62,47 @@ Cypress.Commands.add('login', (username: string) => { localStorage.setItem(STORAGE_KEY, JSON.stringify(dataWithUser)); }); +type DatePickerDataTest = 'field' | 'today'; +type ChildParent = 'child' | 'parent'; +type Direction = 'source' | 'destination'; /** * When removing `data-test` properties from code, * please also remove it from here */ export type DataTest = + | 'add-flow-nav-button' + | 'add-flow-source-organization-field' + | 'add-flow-source-location-field' + | 'add-flow-source-usage-year-field' + | 'add-flow-destination-project-field' + | 'add-flow-destination-plan-field' + | 'add-flow-destination-global-cluster-field' + | 'add-flow-destination-usage-year-field' + | 'add-flow-destination-location-field' + | 'add-flow-destination-organization-field' + | 'add-flow-original-currency-funding-amount-field' + | 'add-flow-original-currency-field' + | 'add-flow-exchange-rate-field' + | 'add-flow-original-currency-button' + | 'add-flow-amount-USD-field' + | 'add-flow-description-field' + | 'add-flow-readonly-source-organization-field' + | 'add-flow-readonly-source-location-field' + | 'add-flow-readonly-source-usage-year-field' + | `add-flow-first-reported-${DatePickerDataTest}` + | `add-flow-decision-date-${DatePickerDataTest}` + | 'add-flow-flow-status-field' + | `add-flow-flow-date-${DatePickerDataTest}` + | `add-flow-reported-by-organization-${number}-options-${Direction}-${number}` + | `add-flow-reported-channel-field-${number}` + | `add-flow-date-reported-${DatePickerDataTest}-${number}` + | 'add-flow-create-button' + | 'add-flow-copy-button' + | 'add-flow-title' + | 'add-flow-add-parent-flow-button' + | `add-flow-add-${ChildParent}-flow-field` + | 'add-flow-add-parent-flow-submit-button' + | `add-flow-${ChildParent}-flow-table` | 'flows-nav-button' | 'flows-table' | 'flows-table-checkbox' diff --git a/apps/hpc-ftsadmin-e2e/src/tests/add-flow.cy.ts b/apps/hpc-ftsadmin-e2e/src/tests/add-flow.cy.ts index 36d03b5a6..89bacf983 100644 --- a/apps/hpc-ftsadmin-e2e/src/tests/add-flow.cy.ts +++ b/apps/hpc-ftsadmin-e2e/src/tests/add-flow.cy.ts @@ -1,3 +1,4 @@ +import * as dayjs from 'dayjs'; import * as ADD_FLOW from '../fixtures/add-flow.json'; import { selectOption } from '../support/select-component-utils'; @@ -8,10 +9,10 @@ describe('hpc-ftsadmin add-flow', () => { cy.visit('/'); cy.location('pathname').should('eq', '/flows'); cy.typedGet('add-flow-nav-button').click(); - cy.location('pathname').should('eq', '/flow/add'); + cy.location('pathname').should('eq', '/flows/add'); }); - it('bulkRejectPendingFlows workflow', () => { + it('Add flow', () => { cy.typedGet('add-flow-source-organization-field').type( ADD_FLOW['test1']['add-flow-source-organization-field'] ); @@ -34,7 +35,7 @@ describe('hpc-ftsadmin add-flow', () => { selectOption(ADD_FLOW['test1']['add-flow-destination-project-field']); cy.typedGet('add-flow-destination-plan-field').should( - 'contain', + 'contain.html', 'Afghanistan 2002 (ITAP for the Afghan People)' ); cy.typedGet('add-flow-destination-global-cluster-field').should( @@ -43,7 +44,7 @@ describe('hpc-ftsadmin add-flow', () => { ); cy.typedGet('add-flow-destination-usage-year-field').should( 'contain', - '2022' + '2002' ); cy.typedGet('add-flow-destination-location-field').should( 'contain', @@ -58,13 +59,11 @@ describe('hpc-ftsadmin add-flow', () => { * Original Currency related testing */ - cy.typedGet('add-flow-original-currency-dropdown').click(); - cy.typedGet('add-flow-original-currency-funding-amount-field').type( ADD_FLOW['test1']['add-flow-original-currency-funding-amount-field'] ); cy.typedGet('add-flow-original-currency-field').click(); - selectOption('LAK'); + selectOption('EUR'); cy.typedGet('add-flow-exchange-rate-field').type( ADD_FLOW['test1']['add-flow-exchange-rate-field'] @@ -99,6 +98,7 @@ describe('hpc-ftsadmin add-flow', () => { 'contain.text', 'Calculate the exchange rate' ); + /* * -------------------------------------------------------- */ @@ -107,22 +107,23 @@ describe('hpc-ftsadmin add-flow', () => { ADD_FLOW['test1']['add-flow-description-field'] ); - const date = new Date().toLocaleDateString('en-GB'); - cy.typedGet('add-flow-first-reported-field').type(date); - cy.typedGet('add-flow-decision-date-field').type(date); + const date = dayjs().format('DD/MM/YYYY'); + cy.typedGet('add-flow-first-reported-today').click(); + cy.typedGet('add-flow-decision-date-today').click(); cy.typedGet('add-flow-flow-status-field').click(); selectOption('Commitment'); - cy.typedGet('add-flow-flow-date-field').type(date); + cy.typedGet('add-flow-flow-date-today').click(); - // Properly write - cy.typedGet('add-flow-reported-by-organization-options').click(); + cy.typedGet( + 'add-flow-reported-by-organization-0-options-destination-0' + ).click(); - cy.typedGet('add-flow-reported-channel-field').click(); + cy.typedGet('add-flow-reported-channel-field-0').click(); selectOption('Fax'); - cy.typedGet('add-flow-date-reported-field').should('contain', date); + cy.typedGet('add-flow-date-reported-field-0').should('contain.html', date); cy.typedGet('add-flow-create-button').click(); @@ -132,20 +133,27 @@ describe('hpc-ftsadmin add-flow', () => { cy.typedGet('add-flow-add-parent-flow-button').click(); - // TODO: Get previous flow ID - cy.typedGet('add-flow-add-parent-flow-field').type('PREVIOUS FLOW ID'); - selectOption('PREVIOUS FLOW ID'); + // flow 316064 is part of mocked data + cy.typedGet('add-flow-add-parent-flow-field').type('316064'); + selectOption('316064'); cy.typedGet('add-flow-add-parent-flow-submit-button').click(); cy.typedGet('add-flow-parent-flow-table').should('exist'); - }); - /** - * TODO: Add more checking to the test once edit flow is in the app - */ - it('Enter pending-flow', () => { - cy.typedGet('flows-table-row-305776v1').click(); - cy.location('pathname').should('eq', '/flows/305776'); + // Verify source data gets updated when + // a parent flow is selected + cy.typedGet('add-flow-readonly-source-organization-field').should( + 'contain', + 'United States of America, Government of [USA]' + ); + cy.typedGet('add-flow-readonly-source-usage-year-field').should( + 'contain', + '2023' + ); + cy.typedGet('add-flow-readonly-source-location-field').should( + 'contain', + 'United States' + ); }); }); diff --git a/apps/hpc-ftsadmin/src/app/app.tsx b/apps/hpc-ftsadmin/src/app/app.tsx index 2032c4724..bfe8a3bf2 100644 --- a/apps/hpc-ftsadmin/src/app/app.tsx +++ b/apps/hpc-ftsadmin/src/app/app.tsx @@ -143,6 +143,7 @@ export const App = () => { path: paths.addFlow(), icon: MdAdd, selected: false, + dataTest: 'add-flow-nav-button', }, ]} className={CLASSES.CONTAINER.FLUID} diff --git a/apps/hpc-ftsadmin/src/app/components/flow-form/flow-form.tsx b/apps/hpc-ftsadmin/src/app/components/flow-form/flow-form.tsx index db28fae7e..aeafb5b65 100644 --- a/apps/hpc-ftsadmin/src/app/components/flow-form/flow-form.tsx +++ b/apps/hpc-ftsadmin/src/app/components/flow-form/flow-form.tsx @@ -356,12 +356,14 @@ const FlowAmountButton = ({ exchangeRate, setFieldValue, disabled, + dataTest, }: { amountUSD: FlowFormType['amountUSD']; amountOriginalCurrency: FlowFormType['amountOriginalCurrency']; exchangeRate: FlowFormType['exchangeRate']; setFieldValue: FormikHelpers['setFieldValue']; disabled?: boolean; + dataTest?: string; }) => { const { lang } = getContext(); @@ -382,7 +384,14 @@ const FlowAmountButton = ({ (s) => s.components.flowAmountButton.amountOriginalCurrency ), }; - return ; + return ( + + ); } else if (!amountUSDInt && amountOriginalCurrencyInt && exchangeRateFloat) { const buttonProps = { onClick: () => @@ -392,14 +401,28 @@ const FlowAmountButton = ({ ), text: t.t(lang, (s) => s.components.flowAmountButton.amountUSD), }; - return ; + return ( + + ); } const buttonProps = { onClick: () => setFieldValue('exchangeRate', amountOriginalCurrencyInt / amountUSDInt), text: t.t(lang, (s) => s.components.flowAmountButton.exchangeRate), }; - return ; + return ( + + ); }; const BlockNavigationOnUnsavedChanges = ({ dirty }: { dirty: boolean }) => { @@ -985,6 +1008,7 @@ export const FlowForm = (props: FlowFormProps) => { flowFormCopyValues: serializeFlowForm(values), flowFormCopyValuesName: `${flow?.id}v${flow?.versionID}`, }} + data-test="add-flow-copy-button" > {t.t(lang, (s) => s.components.flowForm.copyFlow)} @@ -1050,6 +1074,14 @@ export const FlowForm = (props: FlowFormProps) => { 'fundingSourceProject', ]} values={values} + dataTest={{ + fundingSourceOrganizations: + 'add-flow-readonly-source-organization-field', + fundingSourceUsageYears: + 'add-flow-readonly-source-usage-year-field', + fundingSourceLocations: + 'add-flow-readonly-source-location-field', + }} /> ) : ( @@ -1079,6 +1111,7 @@ export const FlowForm = (props: FlowFormProps) => { ? pendingValues?.fundingSourceOrganizations : undefined } + dataTest="add-flow-source-organization-field" isMulti /> { : undefined } firstViewCondition={usageYearFirstViewCondition} + dataTest="add-flow-source-usage-year-field" isMulti required /> @@ -1125,6 +1159,7 @@ export const FlowForm = (props: FlowFormProps) => { ? pendingValues?.fundingSourceLocations : undefined } + dataTest="add-flow-source-location-field" isMulti /> { pendingValues={ pendingValues?.fundingDestinationOrganizations } + dataTest="add-flow-destination-organization-field" isMulti /> {values.fundingDestinationOrganizations.some( @@ -1352,6 +1388,7 @@ export const FlowForm = (props: FlowFormProps) => { disabled={isDisabled} pendingValues={pendingValues?.fundingDestinationUsageYears} firstViewCondition={usageYearFirstViewCondition} + dataTest="add-flow-destination-usage-year-field" isMulti required /> @@ -1366,6 +1403,7 @@ export const FlowForm = (props: FlowFormProps) => { setPendingValuesHandled={setPendingValuesHandled} disabled={isDisabled} pendingValues={pendingValues?.fundingDestinationLocations} + dataTest="add-flow-destination-location-field" isMulti /> { pendingValues={ pendingValues?.fundingDestinationGlobalClusters } + dataTest="add-flow-destination-global-cluster-field" isMulti /> { }); }} disabled={isDisabled} + dataTest="add-flow-destination-plan-field" /> { }} disabled={isDisabled} pendingValues={pendingValues?.fundingDestinationProject} + dataTest="add-flow-destination-project-field" /> @@ -1515,6 +1556,7 @@ export const FlowForm = (props: FlowFormProps) => { setPendingValuesHandled={setPendingValuesHandled} disabled={isDisabled} pendingValues={pendingValues?.amountUSD} + dataTest="add-flow-amount-USD-field" required /> { sx={tw`basis-4/6`} disabled={isDisabled} pendingValues={pendingValues?.amountOriginalCurrency} + dataTest="add-flow-original-currency-funding-amount-field" /> { sx={tw`basis-2/6`} disabled={isDisabled} pendingValues={pendingValues?.currency} + dataTest="add-flow-original-currency-field" /> { setPendingValuesHandled={setPendingValuesHandled} disabled={isDisabled} pendingValues={pendingValues?.exchangeRate} + dataTest="add-flow-exchange-rate-field" /> { amountOriginalCurrency={values.amountOriginalCurrency} exchangeRate={values.exchangeRate} disabled={isDisabled} + dataTest="add-flow-original-currency-button" /> { .placeholder )} setPendingValuesHandled={setPendingValuesHandled} - required - textarea minRows={2} disabled={isDisabled} pendingValues={pendingValues?.flowDescription} + dataTest="add-flow-description-field" + required + textarea /> { lang, (s) => s.components.datePicker.today )} + dataTest={{ + field: 'add-flow-first-reported-field', + today: 'add-flow-first-reported-today', + }} required /> { lang, (s) => s.components.datePicker.today )} + dataTest={{ + field: 'add-flow-decision-date-field', + today: 'add-flow-decision-date-today', + }} /> { setPendingValuesHandled={setPendingValuesHandled} disabled={isDisabled} pendingValues={pendingValues?.flowStatus} + dataTest="add-flow-flow-status-field" required /> { lang, (s) => s.components.datePicker.today )} + dataTest={{ + field: 'add-flow-flow-date-field', + today: 'add-flow-flow-date-today', + }} required /> { )} > {values.parentFlow && ( - +

Parent Flow

{ )} {values.childFlows.length > 0 && ( - +

Child Flows

{values.childFlows.map((childFlow) => ( @@ -1977,6 +2037,7 @@ export const FlowForm = (props: FlowFormProps) => { .submit.button )} displayLoading={submitLoading} + dataTest="add-flow-create-button" /> )} {isValid && isPending && ( diff --git a/apps/hpc-ftsadmin/src/app/components/flow-form/flow-search.tsx b/apps/hpc-ftsadmin/src/app/components/flow-form/flow-search.tsx index 5abd10901..77ba46087 100644 --- a/apps/hpc-ftsadmin/src/app/components/flow-form/flow-search.tsx +++ b/apps/hpc-ftsadmin/src/app/components/flow-form/flow-search.tsx @@ -47,6 +47,7 @@ const StyledDiv = tw.div` const FlowSearch = (props: FlowSearchProps) => { const { name, text, startIcon, currentFlow } = props; + const hierarchy = name === 'parentFlow' ? 'parent' : 'child'; const env = getEnv(); const lang = getContext().lang; @@ -164,6 +165,7 @@ const FlowSearch = (props: FlowSearchProps) => { color="neutral" onClick={() => setOpen(true)} startIcon={startIcon} + dataTest={`add-flow-add-${hierarchy}-flow-button`} /> { } }} removeOptions={removeOptions} + dataTest={`add-flow-add-${hierarchy}-flow-field`} /> @@ -199,6 +202,7 @@ const FlowSearch = (props: FlowSearchProps) => { color="primary" text={t.t(lang, (s) => s.components.mergeModal.button.next)} onClick={() => handleSubmit()} + dataTest="add-flow-add-parent-flow-submit-button" />
diff --git a/apps/hpc-ftsadmin/src/app/components/flow-form/form-group-readonly.tsx b/apps/hpc-ftsadmin/src/app/components/flow-form/form-group-readonly.tsx index b7f20e8b4..015617175 100644 --- a/apps/hpc-ftsadmin/src/app/components/flow-form/form-group-readonly.tsx +++ b/apps/hpc-ftsadmin/src/app/components/flow-form/form-group-readonly.tsx @@ -23,6 +23,7 @@ type Field = keyof Pick< type FormGroupReadOnlyProps = { fields: Field[]; values: FlowFormType; + dataTest?: Partial>; }; const Label = tw.label` @@ -49,7 +50,7 @@ const isArrayWithContent = ( return Array.isArray(value) && value.length > 0; }; -const FormChip = ({ text }: { text: string }) => { +const FormChip = ({ text, dataTest }: { text: string; dataTest?: string }) => { return ( { m: 0.5, position: 'relative', }} - label={{text}} + label={ + + {text} + + } size="small" color="primary" /> @@ -65,7 +70,11 @@ const FormChip = ({ text }: { text: string }) => { ); }; -const FormGroupReadOnly = ({ fields, values }: FormGroupReadOnlyProps) => { +const FormGroupReadOnly = ({ + fields, + values, + dataTest, +}: FormGroupReadOnlyProps) => { const { lang } = getContext(); return ( @@ -82,7 +91,10 @@ const FormGroupReadOnly = ({ fields, values }: FormGroupReadOnlyProps) => { ) : isArrayWithContent(fieldValue) ? ( fieldValue.map(({ value, displayLabel }) => (
- +
)) ) : ( diff --git a/apps/hpc-ftsadmin/src/app/components/reporting-detail.tsx b/apps/hpc-ftsadmin/src/app/components/reporting-detail.tsx index 55dbe297d..9271a9cb4 100644 --- a/apps/hpc-ftsadmin/src/app/components/reporting-detail.tsx +++ b/apps/hpc-ftsadmin/src/app/components/reporting-detail.tsx @@ -253,22 +253,24 @@ const ReportingDetail = ({ s.components.reportingDetail.reportedByOrganization .organizationsInFlow )} - {values.fundingSourceOrganizations.map((org) => ( + {values.fundingSourceOrganizations.map((org, i) => ( handleChange('reportedByOrganization', org) } key={org.value} + data-test={`add-flow-reported-by-organization-${index}-options-source-${i}`} > {` ${org.displayLabel} `} ))} - {values.fundingDestinationOrganizations.map((org) => ( + {values.fundingDestinationOrganizations.map((org, i) => ( handleChange('reportedByOrganization', org) } key={org.value} + data-test={`add-flow-reported-by-organization-${index}-options-destination-${i}`} > {` ${org.displayLabel} `} @@ -291,6 +293,7 @@ const ReportingDetail = ({ values.reportingDetails[index].reportChannel, lang )} + dataTest={`add-flow-reported-channel-field-${index}`} required /> handleChange('dateReported', value)} disabled={disabled} todayText={t.t(lang, (s) => s.components.datePicker.today)} + dataTest={{ + field: `add-flow-date-reported-field-${index}`, + today: `add-flow-date-reported-today-${index}`, + }} /> { > {(flowFormProps) => ( - + {historyState?.flowFormCopyValues && historyState?.flowFormCopyValuesName ? t.t(lang, (s) => s.components.flow.copyOfFlow, { diff --git a/apps/hpc-ftsadmin/src/app/utils/ellipsis-text.tsx b/apps/hpc-ftsadmin/src/app/utils/ellipsis-text.tsx index ae233f196..b008b294d 100644 --- a/apps/hpc-ftsadmin/src/app/utils/ellipsis-text.tsx +++ b/apps/hpc-ftsadmin/src/app/utils/ellipsis-text.tsx @@ -2,10 +2,12 @@ const EllipsisText = ({ children, maxWidth, iconWidth, + dataTest, }: { children: React.ReactNode; maxWidth: number | string; iconWidth?: number; + dataTest?: string; }) => { const parsedMaxWidth = typeof maxWidth === 'number' @@ -19,6 +21,7 @@ const EllipsisText = ({ textOverflow: 'ellipsis', maxWidth: parsedMaxWidth, }} + data-test={dataTest} > {children} diff --git a/apps/hpc-ftsadmin/src/i18n/langs/en.json b/apps/hpc-ftsadmin/src/i18n/langs/en.json index 4b0e52933..189c907c7 100644 --- a/apps/hpc-ftsadmin/src/i18n/langs/en.json +++ b/apps/hpc-ftsadmin/src/i18n/langs/en.json @@ -75,8 +75,8 @@ "addFLow": "Add Flow" }, "flowAmountButton": { - "amountOriginalCurrency": "Calculate the original amount", - "amountUSD": "Calculate the USD amount", + "amountOriginalCurrency": "Calculate funding amount in its original currency", + "amountUSD": "Calculate the funding amount in USD", "exchangeRate": "Calculate the exchange rate" }, "flowForm": { diff --git a/libs/hpc-dummy/src/lib/data-types.ts b/libs/hpc-dummy/src/lib/data-types.ts index e07070dfb..edc66e345 100644 --- a/libs/hpc-dummy/src/lib/data-types.ts +++ b/libs/hpc-dummy/src/lib/data-types.ts @@ -152,7 +152,16 @@ const GOVERNING_ENTITY = governingEntities.GOVERNING_ENTITY; const LOCATION = locations.LOCATION; const ORGANIZATION = organizations.ORGANIZATION; const PLAN = plans.PLAN; +const PLAN_EXTENDED = plans.getPlanResultCodec([ + 'emergencies', + 'locations', + 'planVersion', + 'years', + 'governingEntities', + 'categories', +]); const PROJECT = projects.PROJECT; +const PROJECT_EXTENDED = projects.GET_PROJECT_RESULT; const USAGE_YEAR = usageYears.USAGE_YEAR; export const DUMMY_DATA = t.type( @@ -163,6 +172,7 @@ export const DUMMY_DATA = t.type( currencies: t.array(CURRENCY), currentUser: t.union([t.null, t.number]), emergencies: t.array(EMERGENCY), + files: t.array(t.unknown), flows: t.array(FLOW), flowRest: t.array(FLOW_REST), globalClusters: t.array(GLOBAL_CLUSTER), @@ -173,7 +183,9 @@ export const DUMMY_DATA = t.type( operationClusters: t.array(OPERATION_CLUSTER), organizations: t.array(ORGANIZATION), plans: t.array(PLAN), + plansExtended: t.array(PLAN_EXTENDED), projects: t.array(PROJECT), + projectsExtended: t.array(PROJECT_EXTENDED), reportingWindows: t.array(REPORTING_WINDOW), usageYears: t.array(USAGE_YEAR), forms: t.array(FORM), diff --git a/libs/hpc-dummy/src/lib/data.ts b/libs/hpc-dummy/src/lib/data.ts index 6a2a6739d..9f1fce916 100644 --- a/libs/hpc-dummy/src/lib/data.ts +++ b/libs/hpc-dummy/src/lib/data.ts @@ -953,6 +953,7 @@ export const INITIAL_DATA: DummyData = { updatedAt: '2017-01-14T00:52:08.895Z', }, ], + files: [], flows: [ { id: 316064, @@ -1635,55 +1636,51 @@ export const INITIAL_DATA: DummyData = { parkedParentSource: null, }, { - id: 305776, + id: 328879, + updatedAt: '2024-11-23T02:26:33.508Z', + amountUSD: '0', versionID: 1, - amountUSD: '550800', - updatedAt: '2024-04-17T02:26:23.447Z', - origAmount: null, - exchangeRate: null, - flowDate: '2024-04-17T00:00:00.000Z', - newMoney: true, - decisionDate: '2024-04-17T00:00:00.000Z', - origCurrency: null, activeStatus: false, restricted: false, - childIDs: null, - parentIDs: [305774], + exchangeRate: null, + flowDate: '2023-02-10T00:00:00.000Z', + newMoney: true, + decisionDate: '2023-02-10T00:00:00.000Z', categories: [ { id: 45, name: 'Pending review', group: 'inactiveReason', - createdAt: '2017-01-13T14:20:32.131Z', - updatedAt: '2017-01-13T14:20:32.131Z', + createdAt: '2016-12-13T12:35:42.929Z', + updatedAt: '2016-12-13T12:35:42.929Z', description: '', parentID: null, code: '', includeTotals: false, categoryRef: { - objectID: 284430, + objectID: 328879, versionID: 1, objectType: 'flow', - categoryID: 50, - updatedAt: '2023-07-24T07:16:19.150Z', + categoryID: 45, + updatedAt: '2024-11-23T02:26:33.261Z', }, }, { id: 47, name: 'Commitment', group: 'flowStatus', - createdAt: '2017-01-13T14:20:32.131Z', - updatedAt: '2017-01-13T14:20:32.131Z', + createdAt: '2017-01-13T14:20:32.002Z', + updatedAt: '2017-01-13T14:20:32.002Z', description: '', parentID: null, code: '', includeTotals: false, categoryRef: { - objectID: 284430, + objectID: 328879, versionID: 1, objectType: 'flow', - categoryID: 50, - updatedAt: '2023-07-24T07:16:19.150Z', + categoryID: 47, + updatedAt: '2024-11-23T02:26:33.251Z', }, }, { @@ -1697,110 +1694,110 @@ export const INITIAL_DATA: DummyData = { code: '', includeTotals: false, categoryRef: { - objectID: 284430, + objectID: 328879, versionID: 1, objectType: 'flow', categoryID: 50, - updatedAt: '2023-07-24T07:16:19.150Z', + updatedAt: '2024-11-23T02:26:16.194Z', }, }, { id: 133, name: 'Standard', group: 'flowType', - createdAt: '2017-01-13T14:20:32.131Z', - updatedAt: '2017-01-13T14:20:32.131Z', + createdAt: '2017-01-13T22:18:02.759Z', + updatedAt: '2017-01-13T22:18:02.759Z', description: '', parentID: null, code: '', includeTotals: false, categoryRef: { - objectID: 284430, + objectID: 328879, versionID: 1, objectType: 'flow', - categoryID: 50, - updatedAt: '2023-07-24T07:16:19.150Z', + categoryID: 133, + updatedAt: '2024-11-23T02:26:33.246Z', }, }, { id: 156, name: 'Traditional aid', group: 'method', - createdAt: '2017-01-13T14:20:32.131Z', - updatedAt: '2017-01-13T14:20:32.131Z', + createdAt: '2017-01-13T22:18:03.323Z', + updatedAt: '2017-01-13T22:18:03.323Z', description: '', parentID: null, code: '', includeTotals: false, categoryRef: { - objectID: 284430, + objectID: 328879, versionID: 1, objectType: 'flow', - categoryID: 50, - updatedAt: '2023-07-24T07:16:19.150Z', + categoryID: 156, + updatedAt: '2024-11-23T02:26:33.259Z', }, }, + ], + organizations: [], + destinationOrganizations: [], + sourceOrganizations: [], + plans: [], + usageYears: [ { - id: 1500, - name: 'Unearmarked', - group: 'earmarkingType', - createdAt: '2017-01-13T14:20:32.131Z', - updatedAt: '2017-01-13T14:20:32.131Z', - description: '', - parentID: null, - code: '', - includeTotals: false, - categoryRef: { - objectID: 284430, - versionID: 1, - objectType: 'flow', - categoryID: 50, - updatedAt: '2023-07-24T07:16:19.150Z', - }, + year: '2022', + direction: 'destination', }, - ], - organizations: [ { - id: 4762, - direction: 'source', - name: 'Central Emergency Response Fund', - abbreviation: 'CERF', + year: '2023', + direction: 'destination', }, { - id: 2915, + year: '2024', direction: 'destination', - name: "United Nations Children's Fund", - abbreviation: 'UNICEF', }, - ], - plans: [], - locations: [{ id: 152, name: 'Mozambique', direction: 'destination' }], - usageYears: [ { year: '2024', direction: 'source', }, { - year: '2024', + year: '2025', + direction: 'destination', + }, + { + year: '2026', direction: 'destination', }, ], + childIDs: [], + parentIDs: [], + origAmount: '600000', + origCurrency: 'EUR', + locations: [], + externalReferences: [ + { + systemID: 'EDRIS', + flowID: 328879, + externalRecordID: '-67653;-70516', + versionID: 1, + updatedAt: '2024-11-23T02:26:33.512Z', + }, + ], reportDetails: [ { - id: 594108, - refCode: '24-RR-CEF-017', - organizationID: 4762, - source: 'Primary', - sourceID: '4973:24-RR-CEF-017:Health', - date: '2024-04-17T00:00:00.000Z', - channel: 'From CERF', + id: 655645, + flowID: 328879, versionID: 1, + contactInfo: + 'EUROPEAN CIVIL PROTECTION AND HUMANITARIAN AID OPERATIONS (ECHO)-CAREY James', + refCode: 'ECHO/ERC/BUD/2022/91013', + organizationID: 8523, + channel: 'From EDRIS', + source: 'Primary', + date: '2024-11-22T00:00:00.000Z', verified: true, - contactInfo: null, - flowID: 12, + sourceID: '-67653;-70516', }, ], - externalReferences: [], parkedParentSource: null, }, ], @@ -3103,40 +3100,51 @@ export const INITIAL_DATA: DummyData = { }, }, { - id: 305776, - versionID: 3, - amountUSD: '550800', - flowDate: '2024-04-18T00:00:00.000Z', - decisionDate: null, - firstReportedDate: '2024-04-17T00:00:00.000Z', - budgetYear: null, - origAmount: null, - origCurrency: null, + id: 328879, + versionID: 1, + amountUSD: '0', + flowDate: '2023-02-10T00:00:00.000Z', + decisionDate: '2023-02-10T00:00:00.000Z', + firstReportedDate: '2024-11-22T00:00:00.000Z', + budgetYear: '2024', + origAmount: '600000', + origCurrency: 'EUR', exchangeRate: null, - activeStatus: true, + activeStatus: false, restricted: false, - newMoney: false, + newMoney: true, description: - 'Support to 2024 displacement in Chiúre District, Cabo Delgado', + 'Hunger and Conflict: protecting people in armed conflict and related violence settings from food insecurity, promoting IHL compliance', notes: - 'HAC-MOZAMBIQUE\tUNOCHA\tRepublic of Mozambique\tSM240169\tMozambique: RR CERF: Support to 2024 displacement in Chiúre District, Cabo Delga\tCross-Sectoral (two or more outcome areas)\t24-RR-CEF-017\t\t2.040.000\t2.040.000\tUSD\t2024\t2.040.000\t16.04.2024\t16.04.2024\tNo\t New \tDifferent\t - \t 2.040.000 \t\t 2.040.000', - versionStartDate: '2024-05-17T14:38:34.547Z', + "Duration From 011222 to 310526 (42 months)\nVersion = 2\n More than one parked flow with this Operation ID (-70516) found, please review the following flow id's (307535, 307535) to see which should be the parent flow.", + versionStartDate: null, versionEndDate: null, - createdAt: '2024-05-17T14:38:34.547Z', - updatedAt: '2024-05-17T14:38:34.547Z', + createdAt: '2024-11-23T02:26:16.178Z', + updatedAt: '2024-11-23T02:26:33.508Z', deletedAt: null, legacy: null, categories: [ { - id: 48, - name: 'Paid', + id: 45, + name: 'Pending review', + description: null, + parentID: null, + code: null, + group: 'inactiveReason', + includeTotals: null, + createdAt: '2016-12-13T12:35:42.929Z', + updatedAt: '2016-12-13T12:35:42.929Z', + }, + { + id: 47, + name: 'Commitment', description: null, parentID: null, code: null, group: 'flowStatus', includeTotals: null, - createdAt: '2017-01-13T14:20:32.042Z', - updatedAt: '2017-01-13T14:20:32.042Z', + createdAt: '2017-01-13T14:20:32.002Z', + updatedAt: '2017-01-13T14:20:32.002Z', }, { id: 50, @@ -3171,356 +3179,296 @@ export const INITIAL_DATA: DummyData = { createdAt: '2017-01-13T22:18:03.323Z', updatedAt: '2017-01-13T22:18:03.323Z', }, - { - id: 1500, - name: 'Unearmarked', - description: null, - parentID: null, - code: null, - group: 'earmarkingType', - includeTotals: null, - createdAt: '2019-01-21T22:46:10.496Z', - updatedAt: '2019-01-21T22:46:10.496Z', - }, ], flowObjects: [ { - flowID: 305776, - objectID: 7, - versionID: 3, - objectType: 'globalCluster', + flowID: 328879, + objectID: 8516, + versionID: 1, + objectType: 'organization', refDirection: 'destination', behavior: null, objectDetail: null, - createdAt: '2024-12-30T11:58:58.764Z', - updatedAt: '2024-12-30T11:58:58.764Z', + createdAt: '2024-11-25T09:30:10.777Z', + updatedAt: '2024-11-25T09:30:10.777Z', }, { - flowID: 305776, - objectID: 7396, - versionID: 3, - objectType: 'governingEntity', - refDirection: 'destination', + flowID: 328879, + objectID: 8523, + versionID: 1, + objectType: 'organization', + refDirection: 'source', behavior: null, objectDetail: null, - createdAt: '2024-12-30T11:58:58.770Z', - updatedAt: '2024-12-30T11:58:58.770Z', + createdAt: '2024-11-25T09:30:10.789Z', + updatedAt: '2024-11-25T09:30:10.789Z', }, { - flowID: 305776, - objectID: 152, - versionID: 3, - objectType: 'location', + flowID: 328879, + objectID: 45, + versionID: 1, + objectType: 'usageYear', refDirection: 'destination', behavior: null, objectDetail: null, - createdAt: '2024-12-30T11:58:58.776Z', - updatedAt: '2024-12-30T11:58:58.776Z', + createdAt: '2024-11-25T09:30:10.770Z', + updatedAt: '2024-11-25T09:30:10.770Z', }, { - flowID: 305776, - objectID: 152, - versionID: 3, - objectType: 'location', + flowID: 328879, + objectID: 45, + versionID: 1, + objectType: 'usageYear', refDirection: 'source', behavior: null, objectDetail: null, - createdAt: '2024-12-30T11:58:58.802Z', - updatedAt: '2024-12-30T11:58:58.802Z', + createdAt: '2024-11-25T09:30:10.783Z', + updatedAt: '2024-11-25T09:30:10.783Z', }, + ], + parents: [], + externalReferences: [ { - flowID: 305776, - objectID: 2915, - versionID: 3, - objectType: 'organization', - refDirection: 'destination', - behavior: null, - objectDetail: null, - createdAt: '2024-12-30T11:58:58.780Z', - updatedAt: '2024-12-30T11:58:58.780Z', + id: 113667, + systemID: 'EDRIS', + flowID: 328879, + versionID: 1, + externalRecordID: '-67653;-70516', + externalRecordDate: '2024-11-22T00:00:00.000Z', + importInformation: { + inferred: [], + transferred: [ + { + key: 'flowObjects.source.usageYear', + valueId: 45, + }, + { + key: 'flowObjects.destination.usageYear', + valueId: 43, + }, + { + key: 'flowObjects.destination.usageYear', + valueId: 44, + }, + { + key: 'flowObjects.destination.usageYear', + valueId: 45, + }, + { + key: 'flowObjects.destination.usageYear', + valueId: 46, + }, + { + key: 'flowObjects.destination.usageYear', + valueId: 47, + }, + ], + }, + createdAt: '2024-11-23T02:26:33.512Z', + updatedAt: '2024-11-23T02:26:33.512Z', }, + ], + children: [], + externalData: [ { - flowID: 305776, - objectID: 2915, - versionID: 3, + id: 89526, + flowID: 328879, + versionID: 1, + systemID: 'EDRIS', + externalRefID: null, + externalRefDate: null, objectType: 'organization', refDirection: 'source', - behavior: null, - objectDetail: null, - createdAt: '2024-12-30T11:58:58.807Z', - updatedAt: '2024-12-30T11:58:58.807Z', + data: 'ECHO', + matched: false, + createdAt: '2024-11-23T02:26:16.218Z', + updatedAt: '2024-11-23T02:26:16.218Z', }, { - flowID: 305776, - objectID: 1183, - versionID: 3, - objectType: 'plan', + id: 89640, + flowID: 328879, + versionID: 1, + systemID: 'EDRIS', + externalRefID: null, + externalRefDate: null, + objectType: 'organization', refDirection: 'destination', - behavior: null, - objectDetail: null, - createdAt: '2024-12-30T11:58:58.786Z', - updatedAt: '2024-12-30T11:58:58.786Z', + data: 'Acción Contra El Hambre (ES)', + matched: false, + createdAt: '2024-11-23T02:26:33.319Z', + updatedAt: '2024-11-23T02:26:33.319Z', }, { - flowID: 305776, - objectID: 207182, - versionID: 3, - objectType: 'project', + id: 89641, + flowID: 328879, + versionID: 1, + systemID: 'EDRIS', + externalRefID: null, + externalRefDate: null, + objectType: 'location', refDirection: 'destination', - behavior: null, - objectDetail: null, - createdAt: '2024-12-30T11:58:58.791Z', - updatedAt: '2024-12-30T11:58:58.791Z', + data: 'NSPE', + matched: false, + createdAt: '2024-11-23T02:26:33.327Z', + updatedAt: '2024-11-23T02:26:33.327Z', }, { - flowID: 305776, - objectID: 45, - versionID: 3, - objectType: 'usageYear', + id: 89642, + flowID: 328879, + versionID: 1, + systemID: 'EDRIS', + externalRefID: null, + externalRefDate: null, + objectType: 'emergency', refDirection: 'destination', - behavior: null, - objectDetail: null, - createdAt: '2024-12-30T11:58:58.797Z', - updatedAt: '2024-12-30T11:58:58.797Z', - }, - { - flowID: 305776, - objectID: 45, - versionID: 3, - objectType: 'usageYear', - refDirection: 'source', - behavior: null, - objectDetail: null, - createdAt: '2024-12-30T11:58:58.812Z', - updatedAt: '2024-12-30T11:58:58.812Z', + data: 'NSPE', + matched: false, + createdAt: '2024-11-23T02:26:33.333Z', + updatedAt: '2024-11-23T02:26:33.333Z', }, ], - externalReferences: [], - parents: [ - { - parentID: 305774, - childID: 305776, - depth: 1, - createdAt: new Date('2024-04-17T02:26:23.572Z'), - updatedAt: new Date('2024-04-17T02:26:23.572Z'), - }, - ], - children: [], - externalData: [], reportDetails: [ { - id: 604909, - flowID: 305776, - versionID: 3, - contactInfo: 'Olga Basurmanova\nobasurmanova@unicef.org', + id: 655645, + flowID: 328879, + versionID: 1, + contactInfo: + 'EUROPEAN CIVIL PROTECTION AND HUMANITARIAN AID OPERATIONS (ECHO)-CAREY James', source: 'Primary', - date: '2024-05-17T00:00:00.000Z', - sourceID: null, - refCode: 'SM240169 24-RR-CEF-017', + date: '2024-11-22T00:00:00.000Z', + sourceID: '-67653;-70516', + refCode: 'ECHO/ERC/BUD/2022/91013', verified: true, - organizationID: 2915, + organizationID: 8523, categories: [ { - id: 138, - name: 'Email', + id: 142, + name: 'From EDRIS', description: null, parentID: null, code: null, group: 'reportChannel', includeTotals: null, - createdAt: '2017-01-13T22:18:02.866Z', - updatedAt: '2017-01-13T22:18:02.866Z', + createdAt: '2017-01-13T22:18:02.943Z', + updatedAt: '2017-01-13T22:18:02.943Z', }, ], organization: { - id: 2915, - name: "United Nations Children's Fund", + id: 8523, + name: "European Commission's Humanitarian Aid and Civil Protection Department", nativeName: - "United Nations Children's Fund formerly United Nations International Children's Emergency Fund", - abbreviation: 'UNICEF', - url: 'https://www.unicef.org/', - parentID: null, - comments: - 'UNICEF works in over 190 countries and territories to save children’s lives, to defend their rights, and to help them fulfil their potential, from early childhood through adolescence. And we never give up.', + 'European Civil Protection and Humanitarian Aid Operations', + abbreviation: 'DG ECHO', + url: 'https://ec.europa.eu/echo/index_en', + parentID: 2966, + comments: null, verified: true, - notes: null, + notes: 'Adding DG to the Abbreviated Name,', active: true, collectiveInd: false, newOrganizationId: null, - createdAt: '2017-01-14T00:53:57.358Z', - updatedAt: '2023-04-23T12:03:56.439Z', + createdAt: '2017-01-14T00:57:50.099Z', + updatedAt: '2023-05-09T09:39:16.905Z', deletedAt: null, }, - reportFiles: [], - }, - ], - plans: [ - { - id: 1183, - planVersion: { - name: 'Mozambique Humanitarian Needs and Response Plan 2024', - }, - flowObject: { - refDirection: 'destination', - }, - }, - ], - organizations: [ - { - id: 2915, - name: "United Nations Children's Fund", - abbreviation: 'UNICEF', - flowObject: { - refDirection: 'destination', - }, - }, - { - id: 2915, - name: "United Nations Children's Fund", - abbreviation: 'UNICEF', - flowObject: { - refDirection: 'source', - }, + reportFiles: [ + { + id: 361226, + reportID: 655645, + title: 'EDRIS link', + type: 'URL', + url: 'https://webgate.ec.europa.eu/hac/index.cfm?page=viewViaMail&op_id=-67653&version_number=2&link_op_id=0&no_spec_obj=0&no_budg_line=0', + fileAssetID: null, + fileAssetEntity: null, + }, + { + id: 361227, + reportID: 655645, + title: '303088--67653;-70516v2.xml', + type: 'file', + url: null, + fileAssetID: 303088, + fileAssetEntity: { + id: 303088, + filename: '303088--67653;-70516v2.xml', + originalname: '-67653;-70516v2.xml', + size: 2625, + mimetype: 'text/xml', + path: '/mnt/www/public/files/fts/303088--67653;-70516v2.xml', + collection: 'fts', + createdAt: '2024-11-23T02:26:33.436Z', + updatedAt: '2024-11-23T02:26:33.473Z', + }, + }, + ], }, ], + plans: [], + organizations: [], anonymizedOrganizations: [], - locations: [ + locations: [], + globalClusters: [], + usageYears: [ { - id: 152, - externalId: '332', - name: 'Mozambique', - adminLevel: 0, - latitude: -17.261776304677, - longitude: 35.552025281488, - iso3: 'MOZ', - pcode: 'MZ', - validOn: null, - status: 'active', - itosSync: true, - createdAt: '2015-09-10T20:25:10.792Z', - updatedAt: '2023-04-29T00:05:06.846Z', - parentId: null, + id: 43, + year: '2022', flowObject: { refDirection: 'destination', }, }, { - id: 152, - externalId: '332', - name: 'Mozambique', - adminLevel: 0, - latitude: -17.261776304677, - longitude: 35.552025281488, - iso3: 'MOZ', - pcode: 'MZ', - validOn: null, - status: 'active', - itosSync: true, - createdAt: '2015-09-10T20:25:10.792Z', - updatedAt: '2023-04-29T00:05:06.846Z', - parentId: null, - flowObject: { - refDirection: 'source', - }, - }, - ], - globalClusters: [ - { - id: 7, - name: 'Health', + id: 44, + year: '2023', flowObject: { refDirection: 'destination', }, }, - ], - usageYears: [ { id: 45, year: '2024', flowObject: { - refDirection: 'source', + refDirection: 'destination', }, }, { id: 45, year: '2024', flowObject: { - refDirection: 'destination', - }, - }, - ], - projects: [ - { - id: 207182, - code: null, - implementationStatus: null, - currentPublishedVersionId: 171778, - creatorParticipantId: 18588, - latestVersionId: 171778, - sourceProjectId: null, - pdf: { - withComments: { - file: { - fileHash: - 'f4f615bc15680211eb20cdffc4c72186aae42cb80cdf908aec98c3e80183d81e', - }, - generatedAt: 1701610072286, - }, - anonymous: { - file: { - fileHash: - '4e6c7433b7f5de733a25dd3ca4d7ca1d934e77fe7b02cf5da1cda292a7320a9c', - }, - generatedAt: 1729514247213, - }, - }, - projectVersions: [ - { - name: 'Access to essential preventive and curative child health services in humanitarian context', - }, - ], - flowObject: { - refDirection: 'destination', + refDirection: 'source', }, - visible: true, }, - ], - emergencies: [], - governingEntities: [ { - id: 7396, - governingEntityVersion: { - name: 'Health', - }, + id: 46, + year: '2025', flowObject: { refDirection: 'destination', }, }, - ], - clusters: [ { - id: 7396, - governingEntityVersion: { - name: 'Health', - }, + id: 47, + year: '2026', flowObject: { refDirection: 'destination', }, }, ], + projects: [], + emergencies: [], + governingEntities: [], + clusters: [], planEntities: [], versions: [ { - id: 305776, + id: 328879, versionID: 1, activeStatus: false, - createdAt: '2024-04-17T02:26:23.447Z', - updatedAt: '2024-04-19T10:01:11.655Z', + createdAt: '2024-11-23T02:26:16.178Z', + updatedAt: '2024-11-23T02:26:33.508Z', deletedAt: null, categories: [ { versionID: 1, - categoryID: 9, + categoryID: 45, }, { versionID: 1, @@ -3538,74 +3486,6 @@ export const INITIAL_DATA: DummyData = { versionID: 1, categoryID: 156, }, - { - versionID: 1, - categoryID: 1500, - }, - ], - }, - { - id: 305776, - versionID: 2, - activeStatus: false, - createdAt: '2024-04-19T02:26:22.729Z', - updatedAt: '2024-05-17T14:38:34.471Z', - deletedAt: null, - categories: [ - { - versionID: 2, - categoryID: 9, - }, - { - versionID: 2, - categoryID: 48, - }, - { - versionID: 2, - categoryID: 50, - }, - { - versionID: 2, - categoryID: 133, - }, - { - versionID: 2, - categoryID: 156, - }, - { - versionID: 2, - categoryID: 1500, - }, - ], - }, - { - id: 305776, - versionID: 3, - activeStatus: true, - createdAt: '2024-05-17T14:38:34.547Z', - updatedAt: '2024-05-17T14:38:34.547Z', - deletedAt: null, - categories: [ - { - versionID: 3, - categoryID: 48, - }, - { - versionID: 3, - categoryID: 50, - }, - { - versionID: 3, - categoryID: 133, - }, - { - versionID: 3, - categoryID: 156, - }, - { - versionID: 3, - categoryID: 1500, - }, ], }, ], @@ -3942,6 +3822,568 @@ export const INITIAL_DATA: DummyData = { parentId: null, children: [], }, + { + id: 1, + externalId: '181', + name: 'Afghanistan', + adminLevel: 0, + latitude: 33.831474768678, + longitude: 66.026218276692, + iso3: 'AFG', + pcode: 'AF', + validOn: null, + status: 'active', + itosSync: true, + createdAt: '2015-09-10T20:25:09.015Z', + updatedAt: '2023-06-25T00:05:08.401Z', + parentId: null, + children: [ + { + id: 25922882, + externalId: null, + name: 'Badakhshan', + adminLevel: 1, + latitude: 37.214179751, + longitude: 70.614095551, + iso3: null, + pcode: 'AF17', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.553Z', + updatedAt: '2024-02-27T13:32:49.716Z', + parentId: 1, + }, + { + id: 25922896, + externalId: null, + name: 'Badghis', + adminLevel: 1, + latitude: 34.827390098, + longitude: 63.124269318, + iso3: null, + pcode: 'AF31', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.612Z', + updatedAt: '2024-02-27T13:32:49.734Z', + parentId: 1, + }, + { + id: 25922874, + externalId: null, + name: 'Baghlan', + adminLevel: 1, + latitude: 36.00691852, + longitude: 68.645170594, + iso3: null, + pcode: 'AF09', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.518Z', + updatedAt: '2024-02-27T13:32:49.755Z', + parentId: 1, + }, + { + id: 25922886, + externalId: null, + name: 'Balkh', + adminLevel: 1, + latitude: 36.702870145, + longitude: 67.114353138, + iso3: null, + pcode: 'AF21', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.568Z', + updatedAt: '2024-02-27T13:32:49.767Z', + parentId: 1, + }, + { + id: 25922875, + externalId: null, + name: 'Bamyan', + adminLevel: 1, + latitude: 34.794628815, + longitude: 67.684319115, + iso3: null, + pcode: 'AF10', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.522Z', + updatedAt: '2024-02-27T13:32:49.772Z', + parentId: 1, + }, + { + id: 25922889, + externalId: null, + name: 'Daykundi', + adminLevel: 1, + latitude: 33.767010771, + longitude: 66.071419548, + iso3: null, + pcode: 'AF24', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.582Z', + updatedAt: '2024-02-27T13:32:49.799Z', + parentId: 1, + }, + { + id: 25922898, + externalId: null, + name: 'Farah', + adminLevel: 1, + latitude: 32.235217792, + longitude: 62.208381474, + iso3: null, + pcode: 'AF33', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.619Z', + updatedAt: '2024-02-27T13:32:49.813Z', + parentId: 1, + }, + { + id: 25922894, + externalId: null, + name: 'Faryab', + adminLevel: 1, + latitude: 35.918782113, + longitude: 64.770654794, + iso3: null, + pcode: 'AF29', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.604Z', + updatedAt: '2024-02-27T13:32:49.819Z', + parentId: 1, + }, + { + id: 25922876, + externalId: null, + name: 'Ghazni', + adminLevel: 1, + latitude: 33.538166557, + longitude: 68.444710194, + iso3: null, + pcode: 'AF11', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.527Z', + updatedAt: '2024-02-27T13:32:49.831Z', + parentId: 1, + }, + { + id: 25922888, + externalId: null, + name: 'Ghor', + adminLevel: 1, + latitude: 34.723784693, + longitude: 65.323739779, + iso3: null, + pcode: 'AF23', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.578Z', + updatedAt: '2024-02-27T13:32:49.848Z', + parentId: 1, + }, + { + id: 25922895, + externalId: null, + name: 'Hilmand', + adminLevel: 1, + latitude: 31.446595224, + longitude: 64.519592482, + iso3: null, + pcode: 'AF30', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.608Z', + updatedAt: '2024-02-27T13:32:49.855Z', + parentId: 1, + }, + { + id: 25922897, + externalId: null, + name: 'Hirat', + adminLevel: 1, + latitude: 34.347718057, + longitude: 62.296268346, + iso3: null, + pcode: 'AF32', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.616Z', + updatedAt: '2024-02-27T13:32:49.860Z', + parentId: 1, + }, + { + id: 25922893, + externalId: null, + name: 'Jawzjan', + adminLevel: 1, + latitude: 36.617679652, + longitude: 65.76233253, + iso3: null, + pcode: 'AF28', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.598Z', + updatedAt: '2024-02-27T13:32:49.872Z', + parentId: 1, + }, + { + id: 25922866, + externalId: null, + name: 'Kabul', + adminLevel: 1, + latitude: 34.5254379, + longitude: 69.135179118, + iso3: null, + pcode: 'AF01', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.477Z', + updatedAt: '2024-02-27T13:32:49.894Z', + parentId: 1, + }, + { + id: 25922892, + externalId: null, + name: 'Kandahar', + adminLevel: 1, + latitude: 31.512686168, + longitude: 65.70859557, + iso3: null, + pcode: 'AF27', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.595Z', + updatedAt: '2024-02-27T13:32:49.915Z', + parentId: 1, + }, + { + id: 25922867, + externalId: null, + name: 'Kapisa', + adminLevel: 1, + latitude: 35.008994819, + longitude: 69.411263499, + iso3: null, + pcode: 'AF02', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.484Z', + updatedAt: '2024-02-27T13:32:49.921Z', + parentId: 1, + }, + { + id: 25922879, + externalId: null, + name: 'Khost', + adminLevel: 1, + latitude: 33.359052359, + longitude: 70.011838254, + iso3: null, + pcode: 'AF14', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.538Z', + updatedAt: '2024-02-27T13:32:49.928Z', + parentId: 1, + }, + { + id: 25922880, + externalId: null, + name: 'Kunar', + adminLevel: 1, + latitude: 34.873485607, + longitude: 71.129987787, + iso3: null, + pcode: 'AF15', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.542Z', + updatedAt: '2024-02-27T13:32:49.933Z', + parentId: 1, + }, + { + id: 25922884, + externalId: null, + name: 'Kunduz', + adminLevel: 1, + latitude: 36.78937377, + longitude: 68.851463957, + iso3: null, + pcode: 'AF19', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.561Z', + updatedAt: '2024-02-27T13:32:49.940Z', + parentId: 1, + }, + { + id: 25922872, + externalId: null, + name: 'Laghman', + adminLevel: 1, + latitude: 34.633643015, + longitude: 69.950912703, + iso3: null, + pcode: 'AF07', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.508Z', + updatedAt: '2024-02-27T13:32:50.005Z', + parentId: 1, + }, + { + id: 25922870, + externalId: null, + name: 'Logar', + adminLevel: 1, + latitude: 33.973780199, + longitude: 69.052835101, + iso3: null, + pcode: 'AF05', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.499Z', + updatedAt: '2024-02-27T13:32:50.086Z', + parentId: 1, + }, + { + id: 25922869, + externalId: null, + name: 'Maidan Wardak', + adminLevel: 1, + latitude: 34.446133369, + longitude: 68.824669115, + iso3: null, + pcode: 'AF04', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.493Z', + updatedAt: '2024-02-27T13:32:50.096Z', + parentId: 1, + }, + { + id: 25922871, + externalId: null, + name: 'Nangarhar', + adminLevel: 1, + latitude: 34.42690434, + longitude: 70.455032282, + iso3: null, + pcode: 'AF06', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.504Z', + updatedAt: '2024-02-27T13:32:50.129Z', + parentId: 1, + }, + { + id: 25922899, + externalId: null, + name: 'Nimroz', + adminLevel: 1, + latitude: 30.89187344, + longitude: 62.026297577, + iso3: null, + pcode: 'AF34', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.623Z', + updatedAt: '2024-02-27T13:32:50.134Z', + parentId: 1, + }, + { + id: 25922881, + externalId: null, + name: 'Nuristan', + adminLevel: 1, + latitude: 35.362263731, + longitude: 70.775640746, + iso3: null, + pcode: 'AF16', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.547Z', + updatedAt: '2024-02-27T13:32:50.141Z', + parentId: 1, + }, + { + id: 25922877, + externalId: null, + name: 'Paktika', + adminLevel: 1, + latitude: 33.211647517, + longitude: 68.747339682, + iso3: null, + pcode: 'AF12', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.531Z', + updatedAt: '2024-02-27T13:32:50.149Z', + parentId: 1, + }, + { + id: 25922878, + externalId: null, + name: 'Paktya', + adminLevel: 1, + latitude: 33.601660348, + longitude: 69.2213731, + iso3: null, + pcode: 'AF13', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.535Z', + updatedAt: '2024-02-27T13:32:50.154Z', + parentId: 1, + }, + { + id: 25922873, + externalId: null, + name: 'Panjsher', + adminLevel: 1, + latitude: 35.367208453, + longitude: 69.504532633, + iso3: null, + pcode: 'AF08', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.514Z', + updatedAt: '2024-02-27T13:32:50.158Z', + parentId: 1, + }, + { + id: 25922868, + externalId: null, + name: 'Parwan', + adminLevel: 1, + latitude: 34.987217739, + longitude: 69.143951146, + iso3: null, + pcode: 'AF03', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.488Z', + updatedAt: '2024-02-27T13:32:50.161Z', + parentId: 1, + }, + { + id: 25922885, + externalId: null, + name: 'Samangan', + adminLevel: 1, + latitude: 36.297075968, + longitude: 68.333742906, + iso3: null, + pcode: 'AF20', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.564Z', + updatedAt: '2024-02-27T13:32:50.166Z', + parentId: 1, + }, + { + id: 25922887, + externalId: null, + name: 'Sar-e-Pul', + adminLevel: 1, + latitude: 36.285137763, + longitude: 66.017983886, + iso3: null, + pcode: 'AF22', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.572Z', + updatedAt: '2024-02-27T13:32:50.171Z', + parentId: 1, + }, + { + id: 25922883, + externalId: null, + name: 'Takhar', + adminLevel: 1, + latitude: 36.717191282, + longitude: 69.513850876, + iso3: null, + pcode: 'AF18', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.557Z', + updatedAt: '2024-02-27T13:32:50.177Z', + parentId: 1, + }, + { + id: 25922890, + externalId: null, + name: 'Uruzgan', + adminLevel: 1, + latitude: 32.666062038, + longitude: 65.894143369, + iso3: null, + pcode: 'AF25', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.586Z', + updatedAt: '2024-02-27T13:32:50.183Z', + parentId: 1, + }, + { + id: 25922891, + externalId: null, + name: 'Zabul', + adminLevel: 1, + latitude: 32.209032296, + longitude: 66.991237167, + iso3: null, + pcode: 'AF26', + validOn: null, + status: 'active', + itosSync: false, + createdAt: '2021-12-23T15:27:14.591Z', + updatedAt: '2024-02-27T13:32:50.188Z', + parentId: 1, + }, + ], + }, ], operations: [ { @@ -5112,6 +5554,95 @@ export const INITIAL_DATA: DummyData = { versionTags: ['1.0'], }, ], + plansExtended: [ + { + id: 92, + restricted: false, + planVersion: { + id: 50, + planId: 92, + name: 'Afghanistan 2002 (ITAP for the Afghan People)', + startDate: '2001-10-01', + endDate: '2002-12-31', + comments: null, + isForHPCProjects: false, + code: 'CAFG0102', + customLocationCode: null, + currentReportingPeriodId: null, + lastPublishedReportingPeriodId: null, + clusterSelectionType: null, + visibilityPreferences: { + isDisaggregationForCaseloads: true, + isDisaggregationForIndicators: true, + }, + currentVersion: true, + latestVersion: true, + latestTaggedVersion: true, + createdAt: '2017-01-14T00:52:54.758Z', + updatedAt: '2024-11-13T17:30:20.358Z', + }, + locations: [ + { + id: 1, + externalId: '181', + name: 'Afghanistan', + adminLevel: 0, + latitude: 33.831474768678, + longitude: 66.026218276692, + iso3: 'AFG', + pcode: 'AF', + validOn: null, + status: 'active', + itosSync: true, + createdAt: '2015-09-10T20:25:09.015Z', + updatedAt: '2023-06-25T00:05:08.401Z', + parentId: null, + }, + ], + governingEntities: [], + categories: [ + { + id: 110, + name: 'CAP', + description: null, + parentID: null, + code: null, + group: 'planType', + includeTotals: true, + createdAt: '2017-01-13T22:18:01.773Z', + updatedAt: '2017-01-17T09:41:10.839Z', + categoryRef: { + objectID: 92, + versionID: 1, + objectType: 'plan', + categoryID: 110, + createdAt: '2017-01-14T00:53:15.484Z', + updatedAt: '2017-01-14T00:53:15.484Z', + }, + }, + ], + emergencies: [], + years: [ + { + id: 23, + year: '2002', + createdAt: '2016-02-23T15:03:30.796Z', + updatedAt: '2016-02-23T15:03:30.796Z', + planYear: { + id: 58, + planId: 92, + usageYearId: 23, + currentVersion: true, + latestVersion: true, + latestTaggedVersion: true, + versionTags: ['1.0'], + createdAt: '2017-01-14T00:53:15.484Z', + updatedAt: '2017-01-14T00:53:15.484Z', + }, + }, + ], + }, + ], projects: [ { id: 1987, @@ -5338,6 +5869,105 @@ export const INITIAL_DATA: DummyData = { visible: true, }, ], + projectsExtended: [ + { + id: 1988, + code: 'apts627', + implementationStatus: 'Implementing', + currentPublishedVersionId: 3976, + creatorParticipantId: null, + latestVersionId: 3976, + sourceProjectId: null, + pdf: null, + createdAt: '2002-02-28T00:00:00.000Z', + updatedAt: '2017-02-06T20:16:57.153Z', + projectVersion: { + id: 3976, + endDate: '2002-12-01', + projectId: 1988, + startDate: '2002-01-01', + globalClusters: [ + { + id: 26479, + hrinfoId: null, + type: 'custom', + name: 'Multi-sector', + code: 'MS', + homepage: null, + defaultIconId: 'other_clusters_multi-sector_icon', + parentId: null, + displayFTSSummariesFromYear: 2012, + createdAt: '2017-01-14T02:13:20.198Z', + updatedAt: '2021-08-24T11:52:24.427Z', + }, + ], + plans: [ + { + id: 92, + planVersion: { + id: 50, + planId: 92, + name: 'Afghanistan 2002 (ITAP for the Afghan People)', + startDate: '2001-10-01', + endDate: '2002-12-31', + comments: null, + isForHPCProjects: false, + code: 'CAFG0102', + customLocationCode: null, + currentReportingPeriodId: null, + lastPublishedReportingPeriodId: null, + clusterSelectionType: null, + visibilityPreferences: { + isDisaggregationForCaseloads: true, + isDisaggregationForIndicators: true, + }, + currentVersion: true, + latestVersion: true, + latestTaggedVersion: true, + createdAt: '2017-01-14T00:52:54.758Z', + updatedAt: '2024-11-13T17:30:20.358Z', + }, + }, + ], + organizations: [ + { + id: 2915, + name: "United Nations Children's Fund", + nativeName: + "United Nations Children's Fund formerly United Nations International Children's Emergency Fund", + abbreviation: 'UNICEF', + url: 'https://www.unicef.org/', + parentID: null, + comments: + 'UNICEF works in over 190 countries and territories to save children’s lives, to defend their rights, and to help them fulfil their potential, from early childhood through adolescence. And we never give up.', + verified: true, + notes: null, + active: true, + collectiveInd: false, + newOrganizationId: null, + createdAt: '2017-01-14T00:53:57.358Z', + updatedAt: '2023-04-23T12:03:56.439Z', + deletedAt: null, + }, + ], + categories: [ + { + id: 62, + name: 'Multi-sector', + code: null, + group: 'sectorIASC', + }, + ], + locations: [ + { + id: 1, + name: 'Afghanistan', + }, + ], + }, + visible: true, + }, + ], reportingWindows: [ { id: 0, diff --git a/libs/hpc-dummy/src/lib/dummy.ts b/libs/hpc-dummy/src/lib/dummy.ts index 327aec477..33fd3813c 100644 --- a/libs/hpc-dummy/src/lib/dummy.ts +++ b/libs/hpc-dummy/src/lib/dummy.ts @@ -575,6 +575,7 @@ export class Dummy { file: FormData ): Promise => { // TODO: Properly add mocked data + this.data.files.push(file); return { collection: 'fts', createdAt: new Date().toISOString(), @@ -590,7 +591,8 @@ export class Dummy { } ), fileDelete: dummyEndpoint('fileAssetEntities.fileDelete', async () => { - throw new errors.NotFoundError(); + this.data.files = []; + return null; }), fileDownload: dummyEndpoint( 'fileAssetEntities.fileDownload', @@ -628,14 +630,13 @@ export class Dummy { getAutocompleteFlows: dummyEndpoint( 'flows.getAutocompleteFlows', async (params: flows.GetFlowsAutocompleteParams) => { - return this.data.flows.filter((flow) => { - return ( + return this.data.flowRest.filter( + (flow) => flow.description ?.toLowerCase() .includes(params.query.toLowerCase()) || flow.id.toString().includes(params.query) - ); - }) as any; // TODO: Remove any + ); } ), searchFlows: dummyEndpoint( @@ -730,6 +731,7 @@ export class Dummy { flowDate, newMoney, restricted, + reportDetails, } = params.flow; // TODO: Properly mock data @@ -746,11 +748,10 @@ export class Dummy { restricted, externalReferences: [], parkedParentSource: { organization: [], orgName: [] }, - reportDetails: [], + reportDetails, } as const; this.data.flows.push(flow as unknown as flows.Flow); - const participant = { name: 'Me' }; const res: flows.GetFlowResult = { ...flow, @@ -776,11 +777,117 @@ export class Dummy { clusters: [], children: [], parents: [], - reportDetails: [], + reportDetails: reportDetails.map((rD) => ({ + ...rD, + categories: [], + organization: { + id: 2915, + name: "United Nations Children's Fund", + nativeName: + "United Nations Children's Fund formerly United Nations International Children's Emergency Fund", + abbreviation: 'UNICEF', + url: 'https://www.unicef.org/', + parentID: null, + comments: + 'UNICEF works in over 190 countries and territories to save children’s lives, to defend their rights, and to help them fulfil their potential, from early childhood through adolescence. And we never give up.', + verified: true, + notes: null, + active: true, + collectiveInd: false, + newOrganizationId: null, + createdAt: '2017-01-14T00:53:57.358Z', + updatedAt: '2023-04-23T12:03:56.439Z', + deletedAt: null, + categories: [ + { + id: 1822, + name: 'UN Agencies', + description: null, + parentID: 1804, + code: null, + group: 'organizationLevel', + includeTotals: null, + createdAt: '2022-12-15T15:17:28.230Z', + updatedAt: '2022-12-15T15:17:28.230Z', + categoryRef: { + objectID: 2915, + versionID: 1, + objectType: 'organization', + categoryID: 1822, + createdAt: '2022-12-15T15:17:28.257Z', + updatedAt: '2022-12-15T15:17:28.257Z', + }, + }, + { + id: 116, + name: 'Multilateral Organizations', + description: null, + parentID: null, + code: null, + group: 'organizationType', + includeTotals: null, + createdAt: '2017-01-13T22:18:02.282Z', + updatedAt: '2022-12-15T15:17:12.882Z', + categoryRef: { + objectID: 2915, + versionID: 1, + objectType: 'organization', + categoryID: 116, + createdAt: '2017-01-14T00:57:01.596Z', + updatedAt: '2017-01-14T00:57:01.596Z', + }, + }, + { + id: 1804, + name: 'International Actors', + description: null, + parentID: null, + code: null, + group: 'organizationLevel', + includeTotals: null, + createdAt: '2022-12-15T15:17:12.844Z', + updatedAt: '2022-12-15T15:17:12.844Z', + categoryRef: { + objectID: 2915, + versionID: 1, + objectType: 'organization', + categoryID: 1804, + createdAt: '2022-12-15T15:17:28.257Z', + updatedAt: '2022-12-15T15:17:28.257Z', + }, + }, + { + id: 1821, + name: 'UN Agencies', + description: null, + parentID: 116, + code: null, + group: 'organizationType', + includeTotals: null, + createdAt: '2022-12-15T15:17:28.228Z', + updatedAt: '2022-12-15T15:17:28.228Z', + categoryRef: { + objectID: 2915, + versionID: 1, + objectType: 'organization', + categoryID: 1821, + createdAt: '2022-12-15T15:17:28.257Z', + updatedAt: '2022-12-15T15:17:28.257Z', + }, + }, + ], + }, + reportFiles: [], + flowID: id, + versionID: 1, + id: 123123, + sourceID: rD.sourceID?.toString() ?? Date.now().toString(), + })), versions: [], externalReferences: [], externalData: [], }; + this.data.flowRest.push(res); return res; } ), @@ -1259,12 +1366,18 @@ export class Dummy { id, scopes, }: plans.GetPlanParams): Promise> => { - const plan = this.data.plans.find((plan) => plan.id === id); + const plan = this.data.plansExtended.find((plan) => plan.id === id); if (!plan) { throw new errors.NotFoundError(); } - // TODO: Fix dummy endpoint - return plan as any; + const planWithSelectedScopes: any = { + id: plan.id, + restricted: plan.restricted, + }; + for (const scope of scopes) { + planWithSelectedScopes[scope] = plan[scope]; + } + return planWithSelectedScopes; } ), getAutocompletePlansById: dummyEndpoint( @@ -1276,7 +1389,6 @@ export class Dummy { if (!plans) { throw new errors.NotFoundError(); } - // TODO: Fix dummy endpoint return plans; } ), @@ -1287,8 +1399,10 @@ export class Dummy { async ({ query, }: projects.GetProjectsAutocompleteParams): Promise => { - return this.data.projects.filter((project) => - project.name.toUpperCase().includes(query.toUpperCase()) + return this.data.projects.filter( + (project) => + project.name.toUpperCase().includes(query.toUpperCase()) || + project.code?.toUpperCase().includes(query.toUpperCase()) ); } ), @@ -1297,7 +1411,13 @@ export class Dummy { async ({ id, }: projects.GetProjectParams): Promise => { - throw new errors.NotFoundError(); + const project = this.data.projectsExtended.find( + (project) => project.id === id + ); + if (!project) { + throw new errors.NotFoundError(); + } + return project; } ), },