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

Function GET

src/app/api/pixels/[pixelId]/shares/route.ts:11–37  ·  view source on GitHub ↗
(request: Request, { params }: { params: Promise<{ pixelId: string }> })

Source from the content-addressed store, hash-verified

9import { createShare, getSharesByEntityId } from '@/queries/prisma';
10
11export async function GET(request: Request, { params }: { params: Promise<{ pixelId: string }> }) {
12 const schema = z.object({
13 ...filterParams,
14 ...pagingParams,
15 });
16
17 const { auth, query, error } = await parseRequest(request, schema);
18
19 if (error) {
20 return error();
21 }
22
23 const { pixelId } = await params;
24 const { page, pageSize, search } = query;
25
26 if (!(await canViewPixel(auth, pixelId))) {
27 return unauthorized();
28 }
29
30 const data = await getSharesByEntityId(pixelId, {
31 page,
32 pageSize,
33 search,
34 });
35
36 return json(data);
37}
38
39export async function POST(request: Request, { params }: { params: Promise<{ pixelId: string }> }) {
40 const schema = z.object({

Callers

nothing calls this directly

Calls 6

parseRequestFunction · 0.90
canViewPixelFunction · 0.90
unauthorizedFunction · 0.90
getSharesByEntityIdFunction · 0.90
jsonFunction · 0.90
errorFunction · 0.85

Tested by

no test coverage detected