diff --git a/apps/edr-freight-api/src/modules/exports/datasets/contracts.dataset.ts b/apps/edr-freight-api/src/modules/exports/datasets/contracts.dataset.ts index 51e99614a..87fa48293 100644 --- a/apps/edr-freight-api/src/modules/exports/datasets/contracts.dataset.ts +++ b/apps/edr-freight-api/src/modules/exports/datasets/contracts.dataset.ts @@ -5,6 +5,7 @@ import { Contract } from '../../contracts/entities/contract.entity'; import { ServiceType } from '../../rule-engine/entities/service-type.entity'; import { applyDirectionScope } from '../../user-trade-access/trade-scope.util'; import { ExportDataset } from '../export.types'; +import { PAYMENT_CURRENCIES } from '@edr/types'; export const contractsDataset: ExportDataset = { key: 'contracts', @@ -109,10 +110,7 @@ export const contractsDataset: ExportDataset = { { key: 'contractKind', label: 'Kind', type: 'text' }, { key: 'tradeDirection', label: 'Direction', type: 'select', options: ['IMPORT', 'EXPORT', 'DOMESTIC'].map((v) => ({ value: v, label: v })) }, { key: 'freightType', label: 'Freight type', type: 'select', options: ['CONTAINER', 'BULK'].map((v) => ({ value: v, label: v })) }, - { key: 'paymentCurrency', label: 'Currency', type: 'select', options: [ - { value: 'ETB', label: 'ETB' }, - { value: 'USD', label: 'USD' }, - ] }, + { key: 'paymentCurrency', label: 'Currency', type: 'select', options: PAYMENT_CURRENCIES.map((v) => ({ value: v, label: v })) }, { key: 'serviceTypeId', label: 'Service type', type: 'text' }, // Routes are one-to-many on contract_routes, so these filter via EXISTS // rather than a column comparison. diff --git a/apps/edr-freight-api/src/modules/reports/revenue-classification.ts b/apps/edr-freight-api/src/modules/reports/revenue-classification.ts index 550475599..b30f16d92 100644 --- a/apps/edr-freight-api/src/modules/reports/revenue-classification.ts +++ b/apps/edr-freight-api/src/modules/reports/revenue-classification.ts @@ -9,6 +9,7 @@ import { CargoType } from '../rule-engine/entities/cargo-type.entity'; import { Yard } from '../rule-engine/entities/yard.entity'; import { applyBookingRefDirectionScope } from '../user-trade-access/trade-scope.util'; import { ReportContext, ReportFilterDef, ReportFilterOption } from './report.types'; +import { PAYMENT_CURRENCIES } from '@edr/types'; /** * The shared vocabulary and SQL behind every revenue report. @@ -463,10 +464,10 @@ export const CURRENCY_FILTER: ReportFilterDef = { key: 'currency', label: 'Currency', type: 'select', - options: [ - { value: 'ETB', label: 'ETB' }, - { value: 'USD', label: 'USD' }, - ], + // Driven by the shared list: a revenue report that cannot be filtered to a currency + // simply never shows that currency's revenue, which is a silent hole rather than an + // error. `currencyOf` still defaults to ETB when the caller picks nothing. + options: PAYMENT_CURRENCIES.map((code) => ({ value: code, label: code })), }; /**