feat: add opportunity workflows, delete routes, company sites, algorithms, and expanded test coverage

This commit is contained in:
2026-03-09 02:56:08 -05:00
parent c0a4d4f919
commit f53b390e18
50 changed files with 8837 additions and 63 deletions
+29
View File
@@ -1351,6 +1351,35 @@ export class OpportunityController {
}
}
/**
* Delete Product
*
* Removes a forecast item from this opportunity in ConnectWise,
* removes the item ID from the local productSequence, and
* invalidates the products cache.
*
* @param forecastItemId - The CW forecast item ID to delete
*/
public async deleteProduct(forecastItemId: number): Promise<void> {
await opportunityCw.deleteProduct(this.cwOpportunityId, forecastItemId);
// Remove the deleted item from the local product sequence
if (this.productSequence.includes(forecastItemId)) {
const updatedSequence = this.productSequence.filter(
(id) => id !== forecastItemId,
);
await prisma.opportunity.update({
where: { id: this.id },
data: { productSequence: updatedSequence },
});
this.productSequence = updatedSequence;
}
await invalidateProductsCache(this.cwOpportunityId);
}
/**
* Fetch Procurement Product By Forecast Item
*