Refactor data insertion via Drizzle

This commit is contained in:
Sean Morley
2024-04-26 22:43:13 +00:00
parent 37f050d254
commit 319a99fed2
25 changed files with 1511 additions and 661 deletions

View File

@@ -1,12 +1,14 @@
import { db } from "$lib/db/db.server";
import { featuredAdventures } from "$lib/db/schema";
import { adventureTable, featuredAdventures } from "$lib/db/schema";
import type { Adventure } from "$lib/utils/types";
import { eq } from "drizzle-orm";
export const load = async () => {
const result = await db
.select()
.from(featuredAdventures)
.orderBy(featuredAdventures.id);
.from(adventureTable)
.where(eq(adventureTable.type, "featured"))
.orderBy(adventureTable.id);
return {
result: result as Adventure[],
};