Remove delete routes

This commit is contained in:
2024-11-20 23:35:49 -05:00
parent 1715f6eeb8
commit f700cad564
2 changed files with 0 additions and 64 deletions

View File

@@ -1,32 +0,0 @@
import { eq } from "drizzle-orm";
import { NextResponse } from "next/server";
import { auth } from "@clerk/nextjs/server";
import { db } from "~/db";
import { participants } from "~/db/schema";
export async function DELETE(request: Request, { params }: any) {
const { userId } = await auth();
if (!userId) {
return new NextResponse("Unauthorized", { status: 401 });
}
const participantId = parseInt(params.id);
try {
const result = await db
.delete(participants)
.where(eq(participants.id, participantId))
.execute();
if (result.rowCount === 0) {
return new NextResponse("Not Found", { status: 404 });
}
return new NextResponse(null, { status: 204 }); // No content for successful deletion
} catch (error) {
console.error("Error deleting participant:", error);
return new NextResponse("Internal Server Error", { status: 500 });
}
}

View File

@@ -1,32 +0,0 @@
import { eq } from "drizzle-orm";
import { NextResponse } from "next/server";
import { auth } from "@clerk/nextjs/server";
import { db } from "~/db";
import { studyTable } from "~/db/schema";
export async function DELETE(request: Request, { params }: { params: { id: string } }) {
const { userId } = await auth();
if (!userId) {
return new NextResponse("Unauthorized", { status: 401 });
}
const { id } = await params;
const studyId = parseInt(id);
try {
const result = await db
.delete(studyTable)
.where(eq(studyTable.id, studyId))
.execute();
if (result.rowCount === 0) {
return new NextResponse("Not Found", { status: 404 });
}
return new NextResponse(null, { status: 204 });
} catch (error) {
console.error("Error deleting study:", error);
return new NextResponse("Internal Server Error", { status: 500 });
}
}