Refactor filter handling for queries.

This commit is contained in:
Mike Cao 2025-07-02 01:44:12 -07:00
parent 5b300f1ff5
commit ee6c68d27c
107 changed files with 731 additions and 835 deletions

View file

@ -2,7 +2,7 @@ import { z } from 'zod';
import { unauthorized, json } from '@/lib/response';
import { getUserWebsites } from '@/queries/prisma/website';
import { pagingParams } from '@/lib/schema';
import { parseRequest } from '@/lib/request';
import { getQueryFilters, parseRequest } from '@/lib/request';
export async function GET(request: Request, { params }: { params: Promise<{ userId: string }> }) {
const schema = z.object({
@ -21,7 +21,9 @@ export async function GET(request: Request, { params }: { params: Promise<{ user
return unauthorized();
}
const websites = await getUserWebsites(userId, query);
const filters = await getQueryFilters(query);
const websites = await getUserWebsites(userId, filters);
return json(websites);
}