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

Function GET

web/src/app/api/user/usage/route.ts:8–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6import { logger } from '@/util/logger'
7
8export async function GET() {
9 const session = await getServerSession(authOptions)
10
11 if (!session?.user?.id) {
12 return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
13 }
14
15 const userId = session.user.id
16
17 try {
18 // Use the new consolidated usage service
19 const usageData = await getUserUsageData({ userId, logger })
20
21 return NextResponse.json(usageData)
22 } catch (error) {
23 console.error('Error fetching usage data:', error)
24 return NextResponse.json(
25 { error: 'Internal server error' },
26 { status: 500 },
27 )
28 }
29}

Callers

nothing calls this directly

Calls 1

getUserUsageDataFunction · 0.90

Tested by

no test coverage detected