Remove userVisitedAdventuresTable

This commit is contained in:
Sean Morley
2024-04-26 23:04:41 +00:00
parent db8fc061f2
commit 08579289a6
36 changed files with 132 additions and 6593 deletions

View File

@@ -1,27 +1,25 @@
import type { RequestEvent } from "@sveltejs/kit";
import { db } from "$lib/db/db.server";
import { eq } from "drizzle-orm";
import { userVisitedAdventures } from "$lib/db/schema";
import { adventureTable } from "$lib/db/schema";
export async function DELETE(event: RequestEvent): Promise<Response> {
if (!event.locals.user) {
return new Response(JSON.stringify({ error: "No user found" }), {
status: 401,
headers: {
"Content-Type": "application/json",
},
});
}
let res = await db
.delete(userVisitedAdventures)
.where(
eq(userVisitedAdventures.userId, event.locals.user.id),
)
.execute();
return new Response(JSON.stringify({ res: res }), {
status: 200,
if (!event.locals.user) {
return new Response(JSON.stringify({ error: "No user found" }), {
status: 401,
headers: {
"Content-Type": "application/json",
},
});
}
}
let res = await db
.delete(adventureTable)
.where(eq(adventureTable.userId, event.locals.user.id))
.execute();
return new Response(JSON.stringify({ res: res }), {
status: 200,
headers: {
"Content-Type": "application/json",
},
});
}