// AGENT INSTRUCTION: After every write (INSERT/UPDATE/DELETE), you MUST: // 1. Insert activity feed entry // 2. Call pg.notify('project_e_events', JSON.stringify({ type, action, id, workspace_id })) // See AGENTS.md for full rules. import { NextRequest, NextResponse } from 'next/server'; import { getAuthUser } from '@/lib/auth'; export async function GET(request: NextRequest) { try { const user = await getAuthUser(request); if (!user) { return NextResponse.json( { error: { code: 'UNAUTHORIZED', message: 'Not authenticated' } }, { status: 401 } ); } return NextResponse.json({ user }); } catch { return NextResponse.json( { error: { code: 'AUTH_ERROR', message: 'Invalid or expired token' } }, { status: 401 } ); } }