Skip to content

Commit

Permalink
(#2181) - relations for transaction monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
liorzam authored Mar 11, 2024
1 parent ed42c07 commit 50e4182
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
Warnings:
- You are about to drop the column `businessId` on the `Alert` table. All the data in the column will be lost.
- You are about to drop the column `endUserId` on the `Alert` table. All the data in the column will be lost.
*/
-- DropForeignKey
ALTER TABLE "Alert" DROP CONSTRAINT "Alert_businessId_fkey";

-- DropForeignKey
ALTER TABLE "Alert" DROP CONSTRAINT "Alert_endUserId_fkey";

-- DropIndex
DROP INDEX "Alert_businessId_idx";

-- DropIndex
DROP INDEX "Alert_endUserId_idx";

-- AlterTable
ALTER TABLE "Alert" DROP COLUMN "businessId",
DROP COLUMN "endUserId";
10 changes: 0 additions & 10 deletions services/workflows-service/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ model EndUser {
projectId String
project Project @relation(fields: [projectId], references: [id])
WorkflowRuntimeDataToken WorkflowRuntimeDataToken[]
Alert Alert[]
Counterparty Counterparty[]
@@unique([projectId, correlationId])
Expand Down Expand Up @@ -141,7 +140,6 @@ model Business {
projectId String
project Project @relation(fields: [projectId], references: [id])
Alert Alert[]
Counterparty Counterparty[]
@@unique([projectId, correlationId])
Expand Down Expand Up @@ -684,12 +682,6 @@ model Alert {
projectId String
project Project @relation(fields: [projectId], references: [id], onUpdate: Cascade, onDelete: NoAction)
businessId String?
business Business? @relation(fields: [businessId], references: [id], onUpdate: Cascade, onDelete: NoAction)
endUserId String?
endUser EndUser? @relation(fields: [endUserId], references: [id], onUpdate: Cascade, onDelete: NoAction)
dataTimestamp DateTime
state AlertState
status AlertStatus
Expand All @@ -712,8 +704,6 @@ model Alert {
counterparty Counterparty? @relation(fields: [counterpartyId], references: [id])
@@index([assigneeId])
@@index([businessId])
@@index([endUserId])
@@index([projectId])
@@index([alertDefinitionId])
@@index([counterpartyId])
Expand Down
16 changes: 14 additions & 2 deletions services/workflows-service/src/alert/alert.controller.external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,22 @@ export class AlertControllerExternal {
lastName: true,
},
},
business: {
counterparty: {
select: {
id: true,
companyName: true,
business: {
select: {
id: true,
companyName: true,
},
},
endUser: {
select: {
id: true,
firstName: true,
lastName: true,
},
},
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion services/workflows-service/src/alert/alert.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export class AlertService {

private createAlert(
alertDef: AlertDefinition,
data: Pick<Prisma.AlertUncheckedCreateInput, 'businessId' | 'endUserId' | 'counterpartyId'>,
data: Pick<Prisma.AlertUncheckedCreateInput, 'counterpartyId'>,
): Promise<Alert> {
return this.alertRepository.create({
data: {
Expand Down

0 comments on commit 50e4182

Please sign in to comment.