Files
clientsflow/Frontend/server/api/documents.get.ts
2026-02-18 13:56:35 +07:00

27 lines
594 B
TypeScript

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,
})),
};
});