mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-12 20:45:20 +02:00
feat(podcasts): add zero schema and queries
This commit is contained in:
parent
15e44616f3
commit
e61308387c
4 changed files with 35 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ import { chatSessionQueries, commentQueries, messageQueries } from "./chat";
|
|||
import { connectorQueries, documentQueries } from "./documents";
|
||||
import { folderQueries } from "./folders";
|
||||
import { notificationQueries } from "./inbox";
|
||||
import { podcastQueries } from "./podcasts";
|
||||
import { userQueries } from "./user";
|
||||
|
||||
export const queries = defineQueries({
|
||||
|
|
@ -16,4 +17,5 @@ export const queries = defineQueries({
|
|||
chatSession: chatSessionQueries,
|
||||
user: userQueries,
|
||||
automationRuns: automationRunQueries,
|
||||
podcasts: podcastQueries,
|
||||
});
|
||||
|
|
|
|||
12
surfsense_web/zero/queries/podcasts.ts
Normal file
12
surfsense_web/zero/queries/podcasts.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { defineQuery } from "@rocicorp/zero";
|
||||
import { z } from "zod";
|
||||
import { zql } from "../schema/index";
|
||||
|
||||
export const podcastQueries = {
|
||||
bySpace: defineQuery(z.object({ searchSpaceId: z.number() }), ({ args: { searchSpaceId } }) =>
|
||||
zql.podcasts.where("searchSpaceId", searchSpaceId).orderBy("createdAt", "desc")
|
||||
),
|
||||
byId: defineQuery(z.object({ podcastId: z.number() }), ({ args: { podcastId } }) =>
|
||||
zql.podcasts.where("id", podcastId).one()
|
||||
),
|
||||
};
|
||||
|
|
@ -4,6 +4,7 @@ import { chatCommentTable, chatSessionStateTable, newChatMessageTable } from "./
|
|||
import { documentTable, searchSourceConnectorTable } from "./documents";
|
||||
import { folderTable } from "./folders";
|
||||
import { notificationTable } from "./inbox";
|
||||
import { podcastTable } from "./podcasts";
|
||||
import { userTable } from "./user";
|
||||
|
||||
const chatCommentRelationships = relationships(chatCommentTable, ({ one }) => ({
|
||||
|
|
@ -38,6 +39,7 @@ export const schema = createSchema({
|
|||
chatSessionStateTable,
|
||||
userTable,
|
||||
automationRunTable,
|
||||
podcastTable,
|
||||
],
|
||||
relationships: [chatCommentRelationships, newChatMessageRelationships],
|
||||
});
|
||||
|
|
|
|||
19
surfsense_web/zero/schema/podcasts.ts
Normal file
19
surfsense_web/zero/schema/podcasts.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { json, number, string, table } from "@rocicorp/zero";
|
||||
|
||||
// Mirrors PODCAST_COLS in the backend zero_publication. status drives the
|
||||
// lifecycle UI by push; spec is the reviewable brief. The bulky source_content
|
||||
// and transcript are intentionally not published and are fetched over REST.
|
||||
export const podcastTable = table("podcasts")
|
||||
.columns({
|
||||
id: number(),
|
||||
title: string(),
|
||||
status: string(),
|
||||
spec: json().optional(),
|
||||
specVersion: number().from("spec_version"),
|
||||
durationSeconds: number().optional().from("duration_seconds"),
|
||||
error: string().optional(),
|
||||
searchSpaceId: number().from("search_space_id"),
|
||||
threadId: number().optional().from("thread_id"),
|
||||
createdAt: number().from("created_at"),
|
||||
})
|
||||
.primaryKey("id");
|
||||
Loading…
Add table
Add a link
Reference in a new issue