Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next15 #279

Merged
merged 17 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// while we still have images written with this old format
export async function GET(
req: Request,
{ params }: { params: { projectId: string; imageId: string } }
props: { params: Promise<{ projectId: string; imageId: string }> }
): Promise<Response> {
const params = await props.params;
return Response.redirect(
new URL(`/api/projects/${params.projectId}/images/${params.imageId}`, req.url)
);
Expand Down
6 changes: 2 additions & 4 deletions frontend/app/api/limits/workspace/[workspaceId]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import { getServerSession } from 'next-auth';
import { authOptions } from '@/lib/auth';
import { fetcher } from '@/lib/utils';

export async function GET(
req: NextRequest,
{ params }: { params: { workspaceId: string } }
): Promise<Response> {
export async function GET(req: NextRequest, props: { params: Promise<{ workspaceId: string }> }): Promise<Response> {
const params = await props.params;
const workspaceId = params.workspaceId;
const session = await getServerSession(authOptions);
const user = session!.user;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import { getServerSession } from 'next-auth';
import { authOptions } from '@/lib/auth';
import { fetcher } from '@/lib/utils';

export async function GET(
req: NextRequest,
{ params }: { params: { workspaceId: string } }
): Promise<Response> {
export async function GET(req: NextRequest, props: { params: Promise<{ workspaceId: string }> }): Promise<Response> {
const params = await props.params;
const workspaceId = params.workspaceId;
const session = await getServerSession(authOptions);
const user = session!.user;
Expand Down
18 changes: 6 additions & 12 deletions frontend/app/api/projects/[projectId]/api-keys/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import { getServerSession } from 'next-auth';

import { authOptions } from '@/lib/auth';

export async function POST(
req: NextRequest,
{ params }: { params: { projectId: string } }
): Promise<Response> {
export async function POST(req: NextRequest, props: { params: Promise<{ projectId: string }> }): Promise<Response> {
const params = await props.params;
const projectId = params.projectId;
const session = await getServerSession(authOptions);
const user = session!.user;
Expand All @@ -26,10 +24,8 @@ export async function POST(
);
}

export async function GET(
req: NextRequest,
{ params }: { params: { projectId: string } }
): Promise<Response> {
export async function GET(req: NextRequest, props: { params: Promise<{ projectId: string }> }): Promise<Response> {
const params = await props.params;
const projectId = params.projectId;
const session = await getServerSession(authOptions);
const user = session!.user;
Expand All @@ -45,10 +41,8 @@ export async function GET(
);
}

export async function DELETE(
req: NextRequest,
{ params }: { params: { projectId: string } }
): Promise<Response> {
export async function DELETE(req: NextRequest, props: { params: Promise<{ projectId: string }> }): Promise<Response> {
const params = await props.params;
const projectId = params.projectId;
const session = await getServerSession(authOptions);
const user = session!.user;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import { fetcher } from '@/lib/utils';

export async function GET(
req: Request,
{
params
}: { params: { projectId: string; datasetId: string; datapointId: string } }
props: { params: Promise<{ projectId: string; datasetId: string; datapointId: string }> }
) {
const params = await props.params;

const datapoint = await db.query.datasetDatapoints.findFirst({
where: and(
eq(datasetDatapoints.id, params.datapointId),
Expand All @@ -29,10 +29,9 @@ export async function GET(

export async function POST(
req: Request,
{
params
}: { params: { projectId: string; datasetId: string; datapointId: string } }
props: { params: Promise<{ projectId: string; datasetId: string; datapointId: string }> }
): Promise<Response> {
const params = await props.params;

const datasetId = params.datasetId;
const datapointId = params.datapointId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { fetcher } from '@/lib/utils';

export async function DELETE(
req: Request,
{ params }: { params: { projectId: string; datasetId: string } }
props: { params: Promise<{ projectId: string; datasetId: string }> }
): Promise<Response> {
const params = await props.params;
const projectId = params.projectId;
const datasetId = params.datasetId;
const session = await getServerSession(authOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import { fetcher } from '@/lib/utils';

export async function GET(
req: NextRequest,
{ params }: { params: { projectId: string; datasetId: string } }
props: { params: Promise<{ projectId: string; datasetId: string }> }
): Promise<Response> {
const params = await props.params;
const projectId = params.projectId;
const datasetId = params.datasetId;
const session = await getServerSession(authOptions);
Expand Down Expand Up @@ -39,8 +40,9 @@ const CreateDatapointsSchema = z.object({

export async function POST(
req: Request,
{ params }: { params: { projectId: string; datasetId: string } }
props: { params: Promise<{ projectId: string; datasetId: string }> }
): Promise<Response> {
const params = await props.params;
const projectId = params.projectId;
const datasetId = params.datasetId;

Expand Down Expand Up @@ -116,8 +118,9 @@ export async function POST(

export async function DELETE(
req: Request,
{ params }: { params: { projectId: string; datasetId: string } }
props: { params: Promise<{ projectId: string; datasetId: string }> }
): Promise<Response> {
const params = await props.params;
const projectId = params.projectId;
const datasetId = params.datasetId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import { DownloadFormat } from '@/lib/types';

export async function GET(
req: Request,
{
params
}: {
params: { projectId: string; datasetId: string; format: DownloadFormat };
props: {
params: Promise<{ projectId: string; datasetId: string; format: DownloadFormat }>;
}
): Promise<Response> {
const params = await props.params;


const projectId = params.projectId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import { fetcher } from '@/lib/utils';

export async function POST(
req: NextRequest,
{ params }: { params: { projectId: string; datasetId: string } }
props: { params: Promise<{ projectId: string; datasetId: string }> }
): Promise<Response> {
const params = await props.params;
const projectId = params.projectId;
const datasetId = params.datasetId;
const session = await getServerSession(authOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { fetcher } from '@/lib/utils';

export async function POST(
req: Request,
{ params }: { params: { projectId: string; datasetId: string } }
props: { params: Promise<{ projectId: string; datasetId: string }> }
): Promise<Response> {
const params = await props.params;
const projectId = params.projectId;
const datasetId = params.datasetId;
const session = await getServerSession(authOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import { fetcher } from '@/lib/utils';

export async function GET(
req: Request,
{ params }: { params: { projectId: string; datasetId: string } }
props: { params: Promise<{ projectId: string; datasetId: string }> }
): Promise<Response> {
const params = await props.params;
const projectId = params.projectId;
const datasetId = params.datasetId;

Expand All @@ -22,8 +23,9 @@ export async function GET(

export async function DELETE(
req: Request,
{ params }: { params: { projectId: string; datasetId: string } }
props: { params: Promise<{ projectId: string; datasetId: string }> }
): Promise<Response> {
const params = await props.params;
const projectId = params.projectId;
const datasetId = params.datasetId;
const session = await getServerSession(authOptions);
Expand Down
15 changes: 6 additions & 9 deletions frontend/app/api/projects/[projectId]/datasets/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ import { db } from '@/lib/db/drizzle';
import { datasetDatapoints,datasets } from '@/lib/db/migrations/schema';
import { paginatedGet } from '@/lib/db/utils';

export async function POST(
req: Request,
{ params }: { params: { projectId: string } }
): Promise<Response> {
export async function POST(req: Request, props: { params: Promise<{ projectId: string }> }): Promise<Response> {
const params = await props.params;
const projectId = params.projectId;
const body = await req.json();
const { name } = body;
Expand All @@ -31,10 +29,8 @@ export async function POST(
return new Response(JSON.stringify(dataset), { status: 200 });
}

export async function GET(
req: NextRequest,
{ params }: { params: { projectId: string } }
): Promise<Response> {
export async function GET(req: NextRequest, props: { params: Promise<{ projectId: string }> }): Promise<Response> {
const params = await props.params;
const projectId = params.projectId;

const pageNumber =
Expand Down Expand Up @@ -65,8 +61,9 @@ export async function GET(

export async function DELETE(
req: Request,
{ params }: { params: { projectId: string; datasetId: string } }
props: { params: Promise<{ projectId: string; datasetId: string }> }
): Promise<Response> {
const params = await props.params;
const projectId = params.projectId;

const { searchParams } = new URL(req.url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import { getEvaluationTimeProgression } from "@/lib/clickhouse/evaluation-scores
import { AggregationFunction, TimeRange } from "@/lib/clickhouse/utils";


export const GET = async (request: NextRequest, { params }: { params: { projectId: string, groupId: string } }) => {
export const GET = async (
request: NextRequest,
props: { params: Promise<{ projectId: string, groupId: string }> }
) => {
const params = await props.params;
const { projectId, groupId } = params;
let timeRange: TimeRange;
if (request.nextUrl.searchParams.get('pastHours')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { NextRequest, NextResponse } from 'next/server';
import { db } from '@/lib/db/drizzle';
import { evaluations } from '@/lib/db/migrations/schema';

export async function GET(request: NextRequest, { params }: { params: { projectId: string } }) {
export async function GET(request: NextRequest, props: { params: Promise<{ projectId: string }> }) {
const params = await props.params;
const projectId = params.projectId;
const groupedEvaluations = db.$with('grouped_evaluations').as(
db.select({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import { getServerSession } from 'next-auth';
import { authOptions } from '@/lib/auth';
import { fetcher } from '@/lib/utils';

export async function GET(
req: NextRequest,
{ params }: { params: { projectId: string } }
): Promise<Response> {
export async function GET(req: NextRequest, props: { params: Promise<{ projectId: string }> }): Promise<Response> {
const params = await props.params;
const projectId = params.projectId;
const session = await getServerSession(authOptions);
const user = session!.user;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import { getServerSession } from 'next-auth';
import { authOptions } from '@/lib/auth';
import { fetcher } from '@/lib/utils';

export async function GET(
req: NextRequest,
{ params }: { params: { projectId: string } }
): Promise<Response> {
export async function GET(req: NextRequest, props: { params: Promise<{ projectId: string }> }): Promise<Response> {
const params = await props.params;
const projectId = params.projectId;
const session = await getServerSession(authOptions);
const user = session!.user;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import { DownloadFormat } from '@/lib/types';

export async function GET(
req: Request,
{
params
}: {
params: { projectId: string; evaluationId: string; format: DownloadFormat };
props: {
params: Promise<{ projectId: string; evaluationId: string; format: DownloadFormat }>;
}
): Promise<Response> {
const params = await props.params;
const projectId = params.projectId;
const evaluationId = params.evaluationId;
const format = params.format as DownloadFormat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import {

export async function GET(
req: Request,
{ params }: { params: { projectId: string; evaluationId: string } }
props: { params: Promise<{ projectId: string; evaluationId: string }> }
): Promise<Response> {
const params = await props.params;
const projectId = params.projectId;
const evaluationId = params.evaluationId;

Expand Down
12 changes: 4 additions & 8 deletions frontend/app/api/projects/[projectId]/evaluations/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ import { evaluations } from '@/lib/db/migrations/schema';
import { paginatedGet } from '@/lib/db/utils';
import { Evaluation } from '@/lib/evaluation/types';

export async function GET(
req: NextRequest,
{ params }: { params: { projectId: string } }
): Promise<Response> {
export async function GET(req: NextRequest, props: { params: Promise<{ projectId: string }> }): Promise<Response> {
const params = await props.params;
const projectId = params.projectId;
const groupId = req.nextUrl.searchParams.get('groupId');
const filters: SQL[] = [eq(evaluations.projectId, projectId)];
Expand All @@ -26,10 +24,8 @@ export async function GET(
return Response.json(result);
}

export async function DELETE(
req: Request,
{ params }: { params: { projectId: string } }
): Promise<Response> {
export async function DELETE(req: Request, props: { params: Promise<{ projectId: string }> }): Promise<Response> {
const params = await props.params;
const projectId = params.projectId;

const { searchParams } = new URL(req.url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ const bucket = process.env.S3_TRACE_PAYLOADS_BUCKET ?? '';

export async function GET(
req: Request,
{ params }: { params: { projectId: string; imageId: string } }
props: { params: Promise<{ projectId: string; imageId: string }> }
): Promise<Response> {
const params = await props.params;
const { projectId, imageId } = params;
const getObjectRequest = new GetObjectCommand({
Bucket: bucket,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import { labelClassesForPath } from '@/lib/db/migrations/schema';

export async function DELETE(
req: Request,
{
params
}: { params: { projectId: string; labelClassId: string; id: string } }
props: { params: Promise<{ projectId: string; labelClassId: string; id: string }> }
): Promise<Response> {
const params = await props.params;

const projectId = params.projectId;
const id = params.id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { fetcher } from '@/lib/utils';

export async function POST(
req: Request,
{ params }: { params: { projectId: string; labelClassId: string } }
props: { params: Promise<{ projectId: string; labelClassId: string }> }
): Promise<Response> {
const params = await props.params;
const projectId = params.projectId;
const labelClassId = params.labelClassId;
const session = await getServerSession(authOptions);
Expand Down
Loading
Loading