Start changes for multi site clients

- Org subnet and assign sites and clients out of the same subnet group
  on each org
- Add join table for client on multiple sites
- Start to handle websocket endpoints for these multiple connections
This commit is contained in:
Owen
2025-03-25 22:01:08 -04:00
parent fbe7e0a427
commit 87012c47ea
8 changed files with 210 additions and 196 deletions

View File

@@ -19,6 +19,7 @@ import { createAdminRole } from "@server/setup/ensureActions";
import config from "@server/lib/config";
import { fromError } from "zod-validation-error";
import { defaultRoleAllowedActions } from "../role";
import { getNextAvailableOrgSubnet } from "@server/lib/ip";
const createOrgSchema = z
.object({
@@ -88,6 +89,8 @@ export async function createOrg(
let error = "";
let org: Org | null = null;
const subnet = await getNextAvailableOrgSubnet();
await db.transaction(async (trx) => {
const allDomains = await trx
.select()
@@ -98,7 +101,8 @@ export async function createOrg(
.insert(orgs)
.values({
orgId,
name
name,
subnet,
})
.returning();