Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: tm monitoring changes for better investigation #2842

Draft
wants to merge 6 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion apps/backoffice-v2/src/domains/transactions/fetchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export const TransactionsListSchema = z.array(
export type TTransactionsList = z.output<typeof TransactionsListSchema>;

export const fetchTransactions = async (params: {
counterpartyId: string;
counterpartyId?: string;
page: {
number: number;
size: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const useTransactionsQuery = ({
pageSize,
}: {
alertId: string;
counterpartyId: string;
counterpartyId?: string;
page: number;
pageSize: number;
}) => {
Expand All @@ -22,7 +22,7 @@ export const useTransactionsQuery = ({
page,
pageSize,
}),
enabled: isAuthenticated && !!counterpartyId,
enabled: isAuthenticated,
staleTime: 100_000,
});
};
2 changes: 1 addition & 1 deletion apps/backoffice-v2/src/domains/transactions/query-keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const transactionsQueryKeys = createQueryKeys('transactions', {
...params
}: {
alertId: string;
counterpartyId: string;
counterpartyId?: string;
page: number;
pageSize: number;
}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@ import { useTransactionsQuery } from '@/domains/transactions/hooks/queries/useTr
import { useCallback } from 'react';

export const useTransactionMonitoringAlertsAnalysisPageLogic = () => {
const [{ businessId, counterpartyId }] = useSerializedSearchParams();
const [{ counterpartyId }] = useSerializedSearchParams();
const { alertId } = useParams();
const { data: alertDefinition, isLoading: isLoadingAlertDefinition } =
useAlertDefinitionByAlertIdQuery({
alertId: alertId ?? '',
});
const { data: transactions } = useTransactionsQuery({
alertId: alertId ?? '',
businessId: businessId ?? '',
alertId: alertId?.toString() ?? '',
// @TODO: Remove
counterpartyId: counterpartyId ?? '',
page: 1,
pageSize: 50,
pageSize: 500,
});
const navigate = useNavigate();
const onNavigateBack = useCallback(() => {
Expand Down
7 changes: 5 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions services/workflows-service/jest.config.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testTimeout: 30000,
modulePathIgnorePatterns: ['<rootDir>/dist/'],
testRegex: '(/__tests__/.*|(\\.|/)(unit|e2e|intg)\\.test)\\.ts$',
moduleNameMapper: {
Expand Down
1 change: 1 addition & 0 deletions services/workflows-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"csv-parse": "^5.5.6",
"dayjs": "^1.11.6",
"deep-diff": "^1.0.2",
"deepmerge": "^4.3.0",
"file-type": "^16.5.4",
"helmet": "^6.0.1",
"i18n-iso-countries": "^7.6.0",
Expand Down
2 changes: 1 addition & 1 deletion services/workflows-service/prisma/data-migrations
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- AlterTable
ALTER TABLE "Alert" ADD COLUMN "counterpartyBeneficiaryId" TEXT,
ADD COLUMN "counterpartyOriginatorId" TEXT;

-- CreateIndex
CREATE INDEX "Alert_counterpartyOriginatorId_idx" ON "Alert"("counterpartyOriginatorId");

-- CreateIndex
CREATE INDEX "Alert_counterpartyBeneficiaryId_idx" ON "Alert"("counterpartyBeneficiaryId");

-- AddForeignKey
ALTER TABLE "Alert" ADD CONSTRAINT "Alert_counterpartyOriginatorId_fkey" FOREIGN KEY ("counterpartyOriginatorId") REFERENCES "Counterparty"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Alert" ADD CONSTRAINT "Alert_counterpartyBeneficiaryId_fkey" FOREIGN KEY ("counterpartyBeneficiaryId") REFERENCES "Counterparty"("id") ON DELETE SET NULL ON UPDATE CASCADE;
12 changes: 12 additions & 0 deletions services/workflows-service/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -834,9 +834,15 @@ model Alert {
workflowRuntimeDataId String?
workflowRuntimeData WorkflowRuntimeData? @relation(fields: [workflowRuntimeDataId], references: [id], onUpdate: Cascade, onDelete: NoAction)

// TODO: Remove this field after data migration
counterpartyId String?
counterparty Counterparty? @relation(fields: [counterpartyId], references: [id])

counterpartyOriginatorId String?
counterpartyBeneficiaryId String?
counterpartyOriginator Counterparty? @relation(name: "counterpartyAlertOriginator", fields: [counterpartyOriginatorId], references: [id])
counterpartyBeneficiary Counterparty? @relation(name: "counterpartyAlertBeneficiary", fields: [counterpartyBeneficiaryId], references: [id])

businessId String?
business Business? @relation(fields: [businessId], references: [id])

Expand All @@ -845,6 +851,9 @@ model Alert {
@@index([alertDefinitionId])
@@index([counterpartyId])
@@index([createdAt(sort: Desc)])

@@index([counterpartyOriginatorId])
@@index([counterpartyBeneficiaryId])
}

enum RiskCategory {
Expand Down Expand Up @@ -888,6 +897,9 @@ model Counterparty {
benefitingTransactions TransactionRecord[] @relation("BenefitingCounterparty")
alerts Alert[]

alertsBenefiting Alert[] @relation("counterpartyAlertBeneficiary")
alertsOriginating Alert[] @relation("counterpartyAlertOriginator")

projectId String
project Project @relation(fields: [projectId], references: [id])

Expand Down
Loading
Loading