docker fixes
This commit is contained in:
@@ -7,8 +7,9 @@ import { getToken } from "next-auth/jwt";
|
|||||||
|
|
||||||
export async function POST(
|
export async function POST(
|
||||||
req: Request,
|
req: Request,
|
||||||
{ params }: { params: { id: string } }
|
{ params }: { params: Promise<{ id: string }> }
|
||||||
) {
|
) {
|
||||||
|
const { id } = await params;
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
|
|
||||||
// We need the raw access token from JWT for Google API
|
// We need the raw access token from JWT for Google API
|
||||||
@@ -19,7 +20,7 @@ export async function POST(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const report = await prisma.report.findUnique({
|
const report = await prisma.report.findUnique({
|
||||||
where: { id: params.id, userId: session.user.id },
|
where: { id, userId: session.user.id },
|
||||||
include: { tasks: true, user: true },
|
include: { tasks: true, user: true },
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -45,7 +46,7 @@ export async function POST(
|
|||||||
|
|
||||||
// Update report status to SUBMITTED
|
// Update report status to SUBMITTED
|
||||||
await prisma.report.update({
|
await prisma.report.update({
|
||||||
where: { id: params.id },
|
where: { id },
|
||||||
data: { status: 'SUBMITTED' }
|
data: { status: 'SUBMITTED' }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,9 @@ import { prisma } from "@/lib/prisma";
|
|||||||
// PATCH /api/reports/[id] - Update report status or manager
|
// PATCH /api/reports/[id] - Update report status or manager
|
||||||
export async function PATCH(
|
export async function PATCH(
|
||||||
req: Request,
|
req: Request,
|
||||||
{ params }: { params: { id: string } }
|
{ params }: { params: Promise<{ id: string }> }
|
||||||
) {
|
) {
|
||||||
|
const { id } = await params;
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
|
|
||||||
if (!session) {
|
if (!session) {
|
||||||
@@ -17,7 +18,7 @@ export async function PATCH(
|
|||||||
const { status, managerName } = await req.json();
|
const { status, managerName } = await req.json();
|
||||||
|
|
||||||
const report = await prisma.report.update({
|
const report = await prisma.report.update({
|
||||||
where: { id: params.id, userId: session.user.id },
|
where: { id, userId: session.user.id },
|
||||||
data: { status, managerName },
|
data: { status, managerName },
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -27,8 +28,9 @@ export async function PATCH(
|
|||||||
// GET /api/reports/[id] - Fetch a specific report
|
// GET /api/reports/[id] - Fetch a specific report
|
||||||
export async function GET(
|
export async function GET(
|
||||||
req: Request,
|
req: Request,
|
||||||
{ params }: { params: { id: string } }
|
{ params }: { params: Promise<{ id: string }> }
|
||||||
) {
|
) {
|
||||||
|
const { id } = await params;
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
|
|
||||||
if (!session) {
|
if (!session) {
|
||||||
@@ -36,7 +38,7 @@ export async function GET(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const report = await prisma.report.findUnique({
|
const report = await prisma.report.findUnique({
|
||||||
where: { id: params.id },
|
where: { id },
|
||||||
include: { tasks: true },
|
include: { tasks: true },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user