MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / GET

Function GET

web/src/app/api/admin/relabel-for-user/route.ts:58–91  ·  view source on GitHub ↗
(req: NextRequest)

Source from the content-addressed store, hash-verified

56 | { traceId: string; status: 'error'; model: string; error: string }
57
58export async function GET(req: NextRequest) {
59 const authResult = await checkAdminAuth()
60 if (authResult instanceof NextResponse) {
61 return authResult
62 }
63
64 const userId = req.nextUrl.searchParams.get('userId')
65 if (!userId) {
66 return NextResponse.json(
67 { error: 'Missing required parameter: userId' },
68 { status: 400 },
69 )
70 }
71
72 try {
73 await ensureBigQuery()
74 const traceBundles = await getTracesAndAllDataForUser(userId)
75 const data = formatTraceResults(traceBundles)
76
77 return NextResponse.json({ data })
78 } catch (error) {
79 logger.error(
80 {
81 error,
82 userId,
83 },
84 'Error fetching traces and relabels',
85 )
86 return NextResponse.json(
87 { error: 'Failed to fetch traces and relabels' },
88 { status: 500 },
89 )
90 }
91}
92
93export async function POST(req: NextRequest) {
94 const authResult = await checkAdminAuth()

Callers

nothing calls this directly

Calls 5

checkAdminAuthFunction · 0.90
ensureBigQueryFunction · 0.85
formatTraceResultsFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected