delete resources on delete org

This commit is contained in:
miloschwartz
2025-07-28 12:55:11 -07:00
parent a1e8211ba7
commit 494329f568

View File

@@ -1,6 +1,6 @@
import { Request, Response, NextFunction } from "express"; import { Request, Response, NextFunction } from "express";
import { z } from "zod"; import { z } from "zod";
import { db } from "@server/db"; import { db, resources } from "@server/db";
import { import {
newts, newts,
newtSessions, newtSessions,
@@ -127,6 +127,7 @@ export async function deleteOrg(
} }
await trx.delete(orgs).where(eq(orgs.orgId, orgId)); await trx.delete(orgs).where(eq(orgs.orgId, orgId));
await trx.delete(resources).where(eq(resources.orgId, orgId));
}); });
// Send termination messages outside of transaction to prevent blocking // Send termination messages outside of transaction to prevent blocking