MCPcopy
hub / github.com/umami-software/umami / GET

Function GET

src/app/api/users/[userId]/teams/route.ts:7–28  ·  view source on GitHub ↗
(request: Request, { params }: { params: Promise<{ userId: string }> })

Source from the content-addressed store, hash-verified

5import { getUserTeams } from '@/queries/prisma';
6
7export async function GET(request: Request, { params }: { params: Promise<{ userId: string }> }) {
8 const schema = z.object({
9 ...pagingParams,
10 ...sortingParams,
11 });
12
13 const { auth, query, error } = await parseRequest(request, schema);
14
15 if (error) {
16 return error();
17 }
18
19 const { userId } = await params;
20
21 if (auth.user.id !== userId && !auth.user.isAdmin) {
22 return unauthorized();
23 }
24
25 const teams = await getUserTeams(userId, query);
26
27 return json(teams);
28}

Callers

nothing calls this directly

Calls 5

parseRequestFunction · 0.90
unauthorizedFunction · 0.90
getUserTeamsFunction · 0.90
jsonFunction · 0.90
errorFunction · 0.85

Tested by

no test coverage detected