DB-backed workspace + LangGraph agent
This commit is contained in:
17
Frontend/server/api/auth/me.get.ts
Normal file
17
Frontend/server/api/auth/me.get.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { getAuthContext } from "../../utils/auth";
|
||||
import { prisma } from "../../utils/prisma";
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
try {
|
||||
const auth = await getAuthContext(event);
|
||||
const [user, team, conv] = await Promise.all([
|
||||
prisma.user.findUnique({ where: { id: auth.userId } }),
|
||||
prisma.team.findUnique({ where: { id: auth.teamId } }),
|
||||
prisma.chatConversation.findUnique({ where: { id: auth.conversationId } }),
|
||||
]);
|
||||
if (!user || !team || !conv) throw new Error("unauth");
|
||||
return { user: { id: user.id, email: user.email, name: user.name }, team: { id: team.id, name: team.name }, conversation: { id: conv.id, title: conv.title } };
|
||||
} catch {
|
||||
throw createError({ statusCode: 401, statusMessage: "Unauthorized" });
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user