From fad8143ead02a9b5573bc5a17da67cb04c163b4f Mon Sep 17 00:00:00 2001 From: Jackson Roberts Date: Wed, 29 Apr 2026 01:13:41 +0000 Subject: [PATCH] test: fix current test suite --- api/prisma.config.ts | 1 + api/src/managers/opportunities.ts | 2 +- api/src/workflows/wf.opportunity.ts | 4 ++-- dalpuri/src/translations/opportunity.ts | 14 +++++--------- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/api/prisma.config.ts b/api/prisma.config.ts index 608a1a3..bf6841e 100644 --- a/api/prisma.config.ts +++ b/api/prisma.config.ts @@ -5,5 +5,6 @@ export default { }, datasource: { url: process.env.DATABASE_URL, + shadowDatabaseUrl: process.env.SHADOW_DATABASE_URL, }, } \ No newline at end of file diff --git a/api/src/managers/opportunities.ts b/api/src/managers/opportunities.ts index 8278152..d0ebcf5 100644 --- a/api/src/managers/opportunities.ts +++ b/api/src/managers/opportunities.ts @@ -175,7 +175,7 @@ export const opportunities = { const record = await prisma.opportunity.findFirst({ where: isNumeric - ? { id: Number(identifier) } + ? { cwOpportunityId: Number(identifier) } : { uid: identifier as string }, include: { company: { include: { contacts: true, companyAddresses: true } }, diff --git a/api/src/workflows/wf.opportunity.ts b/api/src/workflows/wf.opportunity.ts index f8cf436..0fd3c28 100644 --- a/api/src/workflows/wf.opportunity.ts +++ b/api/src/workflows/wf.opportunity.ts @@ -1157,9 +1157,9 @@ export async function transitionToQuoteSent( return ok(currentStatus, targetStatus, activities); } - // ── needsRevision flag → PendingRevision ──────────────────────────── + // ── needsRevision flag → Active ────────────────────────────────────── if (payload.needsRevision) { - const targetStatus = OpportunityStatus.PendingRevision; + const targetStatus = OpportunityStatus.Active; const wasAlsoConfirmed = !!payload.quoteConfirmed; diff --git a/dalpuri/src/translations/opportunity.ts b/dalpuri/src/translations/opportunity.ts index 7ffd68f..daa027b 100644 --- a/dalpuri/src/translations/opportunity.ts +++ b/dalpuri/src/translations/opportunity.ts @@ -45,19 +45,15 @@ type CwOpportunityWithMembers = CwOpportunity & { "memberRecId" | "primarySalesFlag" | "secondarySalesFlag" >[]; soOppStatus?: Pick | null; - soInterest?: { description: string | null } | null; }; const toInterest = ( - value: { description: string | null } | null + value: number | null ): OpportunityInterest | null => { if (value == null) return null; - const desc = value.description?.toLowerCase() ?? ""; - if (desc.includes("cold")) return OpportunityInterest.COLD; - if (desc.includes("warm") || desc.includes("medium")) - return OpportunityInterest.WARM; - if (desc.includes("hot")) return OpportunityInterest.HOT; - return null; + if (value <= 1) return OpportunityInterest.COLD; + if (value === 2) return OpportunityInterest.WARM; + return OpportunityInterest.HOT; }; export const opportunityTranslation: Translation< @@ -91,7 +87,7 @@ export const opportunityTranslation: Translation< { from: "soOppStatusRecId", to: "statusId" }, { from: "taxCodeRecId", to: "taxCodeId" }, { - from: "soInterest", + from: "soInterestRecId", to: "interest", process: toInterest, },