Initial commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { auth } from "@/auth";
|
||||
import { db } from "@/lib/db";
|
||||
|
||||
export async function GET(
|
||||
req: NextRequest,
|
||||
{ params }: { params: Promise<{ versionId: string }> }
|
||||
) {
|
||||
const session = await auth();
|
||||
if (!session?.user) {
|
||||
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
||||
}
|
||||
|
||||
const { versionId } = await params;
|
||||
|
||||
const annotations = await db.annotation.findMany({
|
||||
where: { versionId, isVisible: true },
|
||||
include: {
|
||||
author: { select: { id: true, name: true, image: true } },
|
||||
},
|
||||
orderBy: { frameNumber: "asc" },
|
||||
});
|
||||
|
||||
return NextResponse.json({ annotations });
|
||||
}
|
||||
Reference in New Issue
Block a user