DB-backed workspace + LangGraph agent
This commit is contained in:
26
Frontend/server/api/documents.get.ts
Normal file
26
Frontend/server/api/documents.get.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { prisma } from "../utils/prisma";
|
||||
import { getAuthContext } from "../utils/auth";
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const auth = await getAuthContext(event);
|
||||
|
||||
const items = await prisma.workspaceDocument.findMany({
|
||||
where: { teamId: auth.teamId },
|
||||
orderBy: { updatedAt: "desc" },
|
||||
take: 200,
|
||||
});
|
||||
|
||||
return {
|
||||
items: items.map((d) => ({
|
||||
id: d.id,
|
||||
title: d.title,
|
||||
type: d.type,
|
||||
owner: d.owner,
|
||||
scope: d.scope,
|
||||
updatedAt: d.updatedAt.toISOString(),
|
||||
summary: d.summary,
|
||||
body: d.body,
|
||||
})),
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user