SPB Git forge

spb/spb-cloud

Public
10commits 1branches 0releases
3.2 MBsize
maindefault branch
4 h agolast push
JavaScript 56.7% TypeScript 42.6%
682 B · 25 lines typescript
Raw Blame History
1import { NextRequest, NextResponse } from "next/server";2import { prisma } from "@/lib/prisma";34export async function GET(request: NextRequest) {5  const { searchParams } = new URL(request.url);6  const limit = parseInt(searchParams.get("limit") || "50");7  const offset = parseInt(searchParams.get("offset") || "0");89  const [activities, total] = await Promise.all([10    prisma.activityLog.findMany({11      take: limit,12      skip: offset,13      orderBy: { createdAt: "desc" },14      include: { file: { select: { name: true } } },15    }),16    prisma.activityLog.count(),17  ]);1819  return NextResponse.json({20    activities,21    total,22    hasMore: offset + limit < total,23  });24}25