test: fix current test suite
This commit is contained in:
@@ -5,5 +5,6 @@ export default {
|
|||||||
},
|
},
|
||||||
datasource: {
|
datasource: {
|
||||||
url: process.env.DATABASE_URL,
|
url: process.env.DATABASE_URL,
|
||||||
|
shadowDatabaseUrl: process.env.SHADOW_DATABASE_URL,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -175,7 +175,7 @@ export const opportunities = {
|
|||||||
|
|
||||||
const record = await prisma.opportunity.findFirst({
|
const record = await prisma.opportunity.findFirst({
|
||||||
where: isNumeric
|
where: isNumeric
|
||||||
? { id: Number(identifier) }
|
? { cwOpportunityId: Number(identifier) }
|
||||||
: { uid: identifier as string },
|
: { uid: identifier as string },
|
||||||
include: {
|
include: {
|
||||||
company: { include: { contacts: true, companyAddresses: true } },
|
company: { include: { contacts: true, companyAddresses: true } },
|
||||||
|
|||||||
@@ -1157,9 +1157,9 @@ export async function transitionToQuoteSent(
|
|||||||
return ok(currentStatus, targetStatus, activities);
|
return ok(currentStatus, targetStatus, activities);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── needsRevision flag → PendingRevision ────────────────────────────
|
// ── needsRevision flag → Active ──────────────────────────────────────
|
||||||
if (payload.needsRevision) {
|
if (payload.needsRevision) {
|
||||||
const targetStatus = OpportunityStatus.PendingRevision;
|
const targetStatus = OpportunityStatus.Active;
|
||||||
|
|
||||||
const wasAlsoConfirmed = !!payload.quoteConfirmed;
|
const wasAlsoConfirmed = !!payload.quoteConfirmed;
|
||||||
|
|
||||||
|
|||||||
@@ -45,19 +45,15 @@ type CwOpportunityWithMembers = CwOpportunity & {
|
|||||||
"memberRecId" | "primarySalesFlag" | "secondarySalesFlag"
|
"memberRecId" | "primarySalesFlag" | "secondarySalesFlag"
|
||||||
>[];
|
>[];
|
||||||
soOppStatus?: Pick<CwSoOppStatus, "closedFlag"> | null;
|
soOppStatus?: Pick<CwSoOppStatus, "closedFlag"> | null;
|
||||||
soInterest?: { description: string | null } | null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const toInterest = (
|
const toInterest = (
|
||||||
value: { description: string | null } | null
|
value: number | null
|
||||||
): OpportunityInterest | null => {
|
): OpportunityInterest | null => {
|
||||||
if (value == null) return null;
|
if (value == null) return null;
|
||||||
const desc = value.description?.toLowerCase() ?? "";
|
if (value <= 1) return OpportunityInterest.COLD;
|
||||||
if (desc.includes("cold")) return OpportunityInterest.COLD;
|
if (value === 2) return OpportunityInterest.WARM;
|
||||||
if (desc.includes("warm") || desc.includes("medium"))
|
return OpportunityInterest.HOT;
|
||||||
return OpportunityInterest.WARM;
|
|
||||||
if (desc.includes("hot")) return OpportunityInterest.HOT;
|
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const opportunityTranslation: Translation<
|
export const opportunityTranslation: Translation<
|
||||||
@@ -91,7 +87,7 @@ export const opportunityTranslation: Translation<
|
|||||||
{ from: "soOppStatusRecId", to: "statusId" },
|
{ from: "soOppStatusRecId", to: "statusId" },
|
||||||
{ from: "taxCodeRecId", to: "taxCodeId" },
|
{ from: "taxCodeRecId", to: "taxCodeId" },
|
||||||
{
|
{
|
||||||
from: "soInterest",
|
from: "soInterestRecId",
|
||||||
to: "interest",
|
to: "interest",
|
||||||
process: toInterest,
|
process: toInterest,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user