1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-08-03 12:15:19 +02:00

Fix deletion issue

This commit is contained in:
Sean Morley 2024-05-26 23:55:24 +00:00
parent 4fd174530b
commit cb2470070b

View file

@ -1,5 +1,5 @@
import { db } from "$lib/db/db.server"; import { db } from "$lib/db/db.server";
import { userPlannedTrips } from "$lib/db/schema"; import { adventureTable, userPlannedTrips } from "$lib/db/schema";
import { error, type RequestEvent } from "@sveltejs/kit"; import { error, type RequestEvent } from "@sveltejs/kit";
import { and, eq } from "drizzle-orm"; import { and, eq } from "drizzle-orm";
import type { Trip } from "$lib/utils/types"; import type { Trip } from "$lib/utils/types";
@ -103,6 +103,11 @@ export async function DELETE(event: RequestEvent): Promise<Response> {
}); });
} }
let deleted = await db
.delete(adventureTable)
.where(eq(adventureTable.tripId, body.id))
.execute();
let res = await db let res = await db
.delete(userPlannedTrips) .delete(userPlannedTrips)
.where( .where(