DB-backed workspace + LangGraph agent
This commit is contained in:
27
Frontend/server/api/deals.get.ts
Normal file
27
Frontend/server/api/deals.get.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { prisma } from "../utils/prisma";
|
||||
import { getAuthContext } from "../utils/auth";
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const auth = await getAuthContext(event);
|
||||
|
||||
const items = await prisma.deal.findMany({
|
||||
where: { teamId: auth.teamId },
|
||||
include: { contact: { select: { name: true, company: true } } },
|
||||
orderBy: { updatedAt: "desc" },
|
||||
take: 500,
|
||||
});
|
||||
|
||||
return {
|
||||
items: items.map((d) => ({
|
||||
id: d.id,
|
||||
contact: d.contact.name,
|
||||
title: d.title,
|
||||
company: d.contact.company ?? "",
|
||||
stage: d.stage,
|
||||
amount: d.amount ? String(d.amount) : "",
|
||||
nextStep: d.nextStep ?? "",
|
||||
summary: d.summary ?? "",
|
||||
})),
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user