mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-26 23:51:14 +02:00
refactor: remove unused thread metadata migration and clean up chat thread queries
This commit is contained in:
parent
df98144a24
commit
71b1288a7a
8 changed files with 82 additions and 89 deletions
|
|
@ -29,13 +29,3 @@ export const chatSessionQueries = {
|
|||
.one()
|
||||
),
|
||||
};
|
||||
|
||||
export const threadQueries = {
|
||||
byIds: defineQuery(z.object({ ids: z.array(z.number()) }), ({ args: { ids }, ctx }) =>
|
||||
constrainToAllowedSpaces(zql.new_chat_threads, ctx)
|
||||
.where("id", "IN", ids)
|
||||
.where(({ or, cmp }) =>
|
||||
or(cmp("createdById", ctx?.userId ?? ""), cmp("visibility", "SEARCH_SPACE"))
|
||||
)
|
||||
),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,9 +9,6 @@ export const documentQueries = {
|
|||
if (!canReadSpace(ctx, workspaceId)) return denySpace(query).orderBy("createdAt", "desc");
|
||||
return constrainToAllowedSpaces(query, ctx).orderBy("createdAt", "desc");
|
||||
}),
|
||||
byIds: defineQuery(z.object({ ids: z.array(z.number()) }), ({ args: { ids }, ctx }) =>
|
||||
constrainToAllowedSpaces(zql.documents, ctx).where("id", "IN", ids)
|
||||
),
|
||||
};
|
||||
|
||||
export const connectorQueries = {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { defineQueries } from "@rocicorp/zero";
|
||||
import { automationRunQueries } from "./automations";
|
||||
import { chatSessionQueries, commentQueries, messageQueries, threadQueries } from "./chat";
|
||||
import { chatSessionQueries, commentQueries, messageQueries } from "./chat";
|
||||
import { connectorQueries, documentQueries } from "./documents";
|
||||
import { folderQueries } from "./folders";
|
||||
import { notificationQueries } from "./inbox";
|
||||
|
|
@ -15,7 +15,6 @@ export const queries = defineQueries({
|
|||
messages: messageQueries,
|
||||
comments: commentQueries,
|
||||
chatSession: chatSessionQueries,
|
||||
threads: threadQueries,
|
||||
user: userQueries,
|
||||
automationRuns: automationRunQueries,
|
||||
podcasts: podcastQueries,
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@ export const newChatMessageTable = table("new_chat_messages")
|
|||
})
|
||||
.primaryKey("id");
|
||||
|
||||
// Published only as the authz parent of chat messages/comments/session-state
|
||||
// (whereExists("thread") + space constraint). Title/visibility are resolved
|
||||
// over REST (react-query) for the tab bar, not synced through Zero.
|
||||
export const newChatThreadTable = table("new_chat_threads")
|
||||
.columns({
|
||||
id: number(),
|
||||
workspaceId: number().from("workspace_id"),
|
||||
title: string(),
|
||||
visibility: string(),
|
||||
createdById: string().optional().from("created_by_id"),
|
||||
})
|
||||
.primaryKey("id");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue