Skip to content
Open
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
10 changes: 7 additions & 3 deletions app/api/admin/applications/route.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { NextResponse } from "next/server";
import { prisma } from "@/lib/prisma";
import { NextRequest, NextResponse } from "next/server";
import { PrismaClient, Role } from "@/generated/prisma/client";
import { auth } from "@/auth";

export async function GET() {
const prisma = new PrismaClient();
Comment on lines +1 to +5
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if I messed this up when resolving the merge conflicts, but the import statements should be:

import { NextRequest, NextResponse } from "next/server";
import { Role, Prisma } from "@/generated/prisma/client";
import { prisma } from "@/lib/prisma";
import { auth } from "@/auth";

and remove the const prisma = new PrismaClient(); entirely

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the PrismaClient shouldn't be imported here (use the singleton instead)


export async function GET(request: NextRequest) {
try {
const session = await auth();
if (!session?.user?.email) {
Expand Down Expand Up @@ -43,6 +46,7 @@ export async function GET() {
});

return NextResponse.json({ data: applications }, { status: 200 });

} catch (err) {
console.error(err);
return NextResponse.json(
Expand Down