feat(communication): add room visibility and project chat controls
All checks were successful
Build and Release FEDEO / verify (push) Successful in 57s
Build and Release FEDEO / build-and-release (push) Successful in 6m27s

This commit is contained in:
2026-10-02 18:27:02 +02:00
parent 0887863981
commit 7e6c2fbac5
14 changed files with 364 additions and 21 deletions

View File

@@ -0,0 +1,8 @@
ALTER TABLE "projects" ADD COLUMN IF NOT EXISTS "chat_enabled" boolean NOT NULL DEFAULT true;
--> statement-breakpoint
CREATE TABLE "communication_hidden_rooms" (
"tenant_id" bigint NOT NULL REFERENCES "tenants"("id") ON DELETE CASCADE,
"user_id" uuid NOT NULL REFERENCES "auth_users"("id") ON DELETE CASCADE,
"room_key" text NOT NULL,
PRIMARY KEY ("tenant_id", "user_id", "room_key")
);

View File

@@ -526,6 +526,13 @@
"when": 1790899200000,
"tag": "0077_scanner_inbox_preparation",
"breakpoints": true
},
{
"idx": 75,
"version": "7",
"when": 1790985600000,
"tag": "0078_chat_visibility",
"breakpoints": true
}
]
}

View File

@@ -0,0 +1,10 @@
import { bigint, pgTable, primaryKey, text, uuid } from "drizzle-orm/pg-core"
import { authUsers } from "./auth_users"
import { tenants } from "./tenants"
// Room keys also cover collaboration bindings and not-yet-provisioned chats.
export const communicationHiddenRooms = pgTable("communication_hidden_rooms", {
tenantId: bigint("tenant_id", { mode: "number" }).notNull().references(() => tenants.id, { onDelete: "cascade" }),
userId: uuid("user_id").notNull().references(() => authUsers.id, { onDelete: "cascade" }),
roomKey: text("room_key").notNull(),
}, table => ({ pk: primaryKey({ columns: [table.tenantId, table.userId, table.roomKey] }) }))

View File

@@ -19,6 +19,7 @@ export * from "./communication_rooms"
export * from "./communication_room_members"
export * from "./communication_messages"
export * from "./communication_room_reads"
export * from "./communication_hidden_rooms"
export * from "./contacts"
export * from "./contracts"
export * from "./contracttypes"

View File

@@ -66,6 +66,8 @@ export const projects = pgTable("projects", {
archived: boolean("archived").notNull().default(false),
chatEnabled: boolean("chat_enabled").notNull().default(true),
customerRef: text("customerRef"),
updatedAt: timestamp("updated_at", { withTimezone: true }),