Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix: company deletion logic

Brad Barbin83a94dd5df0e
diff --git a/packages/jobs/trigger/weekly.ts b/packages/jobs/trigger/weekly.ts
index 82ebed4b82..73d34f66bd 100644
--- a/packages/jobs/trigger/weekly.ts
+++ b/packages/jobs/trigger/weekly.ts
@@ -64,16 +64,18 @@ export const weekly = schedules.task({
const companiesToDelete =
companies?.filter((company) => {
- // Keep companies with a plan that is not canceled
- if (planMap.get(company.id) !== "Canceled") {
- return false;
+ if (planMap.get(company.id) === "Canceled") {
+ return true;
}
- // Keep companies in bypass list
if (bypassList.includes(company.id)) {
return false;
}
+ if (planMap.get(company.id)) {
+ return false;
+ }
+
// // Keep companies created in the last week
// const createdAt = new Date(company.createdAt);
// if (createdAt > oneWeekAgo) {