Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/packages/search/src/schemas/chat-messages.ts
T

18 lines
866 B
TypeScript

import type { SearchIndexSchema } from "./types.js";
/**
* Team-chat messages (AK-P15b). The in-chat search remains authoritative in
* PostgreSQL because channel membership is finer grained than a tenant-wide
* permission. This schema registers the safe, tenant-scoped projection for
* read-all/admin search consumers without indexing mentions or attachments.
*/
export const chatMessagesIndex: SearchIndexSchema = {
name: "chat-messages",
primaryKey: "id",
searchableAttributes: ["body"],
filterableAttributes: ["tenantId", "chatId", "authorUserId", "parentMessageId", "deleted"],
sortableAttributes: ["createdAt", "updatedAt"],
rankingRules: ["words", "typo", "proximity", "attribute", "sort", "exactness"],
allowedDocumentFields: ["id", "tenantId", "chatId", "authorUserId", "parentMessageId", "body", "deleted", "createdAt", "updatedAt"],
};