27 lines
594 B
TypeScript
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,
|
|
})),
|
|
};
|
|
});
|
|
|