Consolidate the messages into the same enum

This commit is contained in:
Owen
2026-01-17 11:41:10 -08:00
parent 888f5f8bb6
commit ce632a25cf
11 changed files with 85 additions and 54 deletions

View File

@@ -22,6 +22,7 @@ import { sendToClient } from "#dynamic/routers/ws";
import { deletePeer } from "../gerbil/peers";
import { OpenAPITags, registry } from "@server/openApi";
import { OlmErrorCodes } from "../olm/error";
import { sendTerminateClient } from "../client/terminate";
const deleteOrgSchema = z.strictObject({
orgId: z.string()
@@ -207,13 +208,11 @@ export async function deleteOrg(
}
for (const olmId of olmsToTerminate) {
sendToClient(olmId, {
type: "olm/terminate",
data: {
code: OlmErrorCodes.TERMINATED_REKEYED,
message: "Organization has been deleted"
}
}).catch((error) => {
sendTerminateClient(
0, // clientId not needed since we're passing olmId
OlmErrorCodes.TERMINATED_REKEYED,
olmId
).catch((error) => {
logger.error(
"Failed to send termination message to olm:",
error