-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
2,200 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { authOptions } from "@/lib/auth/options"; | ||
import { TraceService } from "@/lib/services/trace_service"; | ||
import { getServerSession } from "next-auth"; | ||
import { redirect } from "next/navigation"; | ||
import { NextRequest, NextResponse } from "next/server"; | ||
|
||
export async function GET(req: NextRequest) { | ||
const session = await getServerSession(authOptions); | ||
|
||
if (!session || !session.user) { | ||
redirect("/login"); | ||
} | ||
|
||
try { | ||
const projectId = req.nextUrl.searchParams.get("projectId") as string; | ||
|
||
if (!projectId) { | ||
return NextResponse.json( | ||
{ error: "Please provide a projectId" }, | ||
{ status: 400 } | ||
); | ||
} | ||
|
||
const traceService = new TraceService(); | ||
const models = await traceService.GetModelsInProject(projectId); | ||
return NextResponse.json( | ||
{ models }, | ||
{ | ||
status: 200, | ||
} | ||
); | ||
} catch (error) { | ||
return NextResponse.json(JSON.stringify({ error }), { | ||
status: 400, | ||
}); | ||
} | ||
} |
Oops, something went wrong.