@@ -0,0 +1,50 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { auth } from "@/auth";
|
||||
import { db } from "@/lib/db";
|
||||
|
||||
export async function GET() {
|
||||
const session = await auth();
|
||||
if (!session?.user) {
|
||||
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
||||
}
|
||||
|
||||
const [
|
||||
approved,
|
||||
review,
|
||||
changes,
|
||||
todo,
|
||||
artists,
|
||||
shots,
|
||||
renderQueue,
|
||||
] = await Promise.all([
|
||||
db.shot.count({
|
||||
where: { shotApprovalStatus: "CLIENT_APPROVED" },
|
||||
}),
|
||||
db.shot.count({
|
||||
where: { status: { in: ["INTERNAL_REVIEW", "READY_FOR_CLIENT", "CLIENT_REVIEW"] } },
|
||||
}),
|
||||
db.shot.count({
|
||||
where: { status: "REVISIONS" },
|
||||
}),
|
||||
db.shot.count({
|
||||
where: { status: "WAITING" },
|
||||
}),
|
||||
db.user.count({
|
||||
where: { role: "ARTIST", isActive: true },
|
||||
}),
|
||||
db.shot.count({}),
|
||||
db.task.count({
|
||||
where: { type: "RENDER", status: { not: "DONE" } },
|
||||
}),
|
||||
]);
|
||||
|
||||
return NextResponse.json({
|
||||
approved,
|
||||
review,
|
||||
changes,
|
||||
todo,
|
||||
artists,
|
||||
shots,
|
||||
renderQueue,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user