diff --git a/app/api/interests/route.ts b/app/api/interests/route.ts index a99a4d78..c2dc808e 100644 --- a/app/api/interests/route.ts +++ b/app/api/interests/route.ts @@ -4,6 +4,7 @@ import { NextResponse } from "next/server"; export async function GET() { try { // Get all interests from the database + const cacheStrategy = { swr: 60, ttl: 60 }; const interests = await prisma.interest.findMany({ select: { id: true, @@ -11,7 +12,8 @@ export async function GET() { }, orderBy: { name: 'asc' - } + }, + cacheStrategy: cacheStrategy, }); const causeAreas = await prisma.causeArea.findMany({ @@ -21,7 +23,8 @@ export async function GET() { }, orderBy: { name: 'asc' - } + }, + cacheStrategy: cacheStrategy, }); const connection = await prisma.connection.findMany({ @@ -31,7 +34,8 @@ export async function GET() { }, orderBy: { name: 'asc' - } + }, + cacheStrategy: cacheStrategy, }); return NextResponse.json({ interests, causeAreas, connection }); diff --git a/app/api/profiles/route.ts b/app/api/profiles/route.ts index 95bc20e7..cdad5c63 100644 --- a/app/api/profiles/route.ts +++ b/app/api/profiles/route.ts @@ -10,7 +10,7 @@ export async function GET(request: Request) { const causeAreas = url.searchParams.get("causeAreas")?.split(",").filter(Boolean) || []; const searchQuery = url.searchParams.get("search") || ""; - const profilesPerPage = 20; + const profilesPerPage = 100; const offset = (page - 1) * profilesPerPage; const session = await getSession(); @@ -84,6 +84,7 @@ export async function GET(request: Request) { } // Fetch paginated and filtered profiles + const cacheStrategy = { swr: 3600, ttl: 3600 }; const profiles = await prisma.user.findMany({ skip: offset, take: profilesPerPage, @@ -104,6 +105,7 @@ export async function GET(request: Request) { }, }, }, + cacheStrategy: cacheStrategy, }); const totalProfiles = await prisma.user.count();