Add search and RAG workspace flows
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user