Add search and RAG workspace flows

This commit is contained in:
2026-03-07 20:34:00 -05:00
parent db01f207a5
commit e20aba998b
35 changed files with 3417 additions and 372 deletions

View File

@@ -62,6 +62,28 @@ export async function listResearchJournalEntries(userId: string, ticker: string,
return rows.map(toResearchJournalEntry);
}
export async function listResearchJournalEntriesForUser(userId: string, limit = 250) {
const safeLimit = Math.min(Math.max(Math.trunc(limit), 1), 500);
const rows = await db
.select()
.from(researchJournalEntry)
.where(eq(researchJournalEntry.user_id, userId))
.orderBy(desc(researchJournalEntry.updated_at), desc(researchJournalEntry.id))
.limit(safeLimit);
return rows.map(toResearchJournalEntry);
}
export async function getResearchJournalEntryRecord(userId: string, id: number) {
const [row] = await db
.select()
.from(researchJournalEntry)
.where(and(eq(researchJournalEntry.user_id, userId), eq(researchJournalEntry.id, id)))
.limit(1);
return row ? toResearchJournalEntry(row) : null;
}
export async function createResearchJournalEntryRecord(input: {
userId: string;
ticker: string;