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

23 lines
516 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.contactPin.findMany({
where: { teamId: auth.teamId },
include: { contact: { select: { name: true } } },
orderBy: { updatedAt: "desc" },
take: 500,
});
return {
items: items.map((p) => ({
id: p.id,
contact: p.contact.name,
text: p.text,
})),
};
});