refactor trpc procedures into domains

This commit is contained in:
Avraham Sakal
2025-07-27 17:22:58 -04:00
parent 25523559aa
commit 3b84e01057
7 changed files with 151 additions and 102 deletions
+2 -2
View File
@@ -76,7 +76,7 @@ export default function ChatPage() {
async function handleDeleteFact(factId: string) {
removeFact(factId);
await trpc.chat.deleteFact.mutate({ factId });
await trpc.chat.facts.deleteOne.mutate({ factId });
}
return (
@@ -90,7 +90,7 @@ export default function ChatPage() {
setConversationTitle(e.target.value);
}}
onBlur={(e) => {
trpc.chat.updateConversationTitle.mutate({
trpc.chat.conversations.updateTitle.mutate({
id: conversationId,
title: e.target.value,
});
+3 -3
View File
@@ -6,13 +6,13 @@ export type Data = Awaited<ReturnType<typeof data>>;
export const data = async (pageContext: PageContextServer) => {
const { id } = pageContext.routeParams;
const caller = createCaller({});
const conversation = await caller.fetchConversation({
const conversation = await caller.conversations.fetchOne({
id,
});
const messages = await caller.fetchMessages({
const messages = await caller.conversations.fetchMessages({
conversationId: id,
});
const facts = await caller.fetchFacts({
const facts = await caller.facts.fetchByConversationId({
conversationId: id,
});
return { conversation, messages, facts };