Add and delete migration files

This commit is contained in:
Sean Morley
2024-04-11 23:58:09 +00:00
parent a17c482522
commit a03fc5fb4e
38 changed files with 1663 additions and 945 deletions

View File

@@ -0,0 +1,19 @@
import { redirect } from "@sveltejs/kit";
import type { PageServerLoad } from "./$types";
import type { Adventure } from "$lib/utils/types";
import { db } from "$lib/db/db.server";
import { worldTravelCountries } from "$lib/db/schema";
export const load: PageServerLoad = async (event) => {
if (!event.locals.user) {
return redirect(302, "/login");
}
let response = await db
.select()
.from(worldTravelCountries)
// let array = result.adventures as Adventure[];
return {
response,
};
};

View File

@@ -0,0 +1,20 @@
<script lang="ts">
import { goto } from "$app/navigation";
import AdventureCard from "$lib/components/AdventureCard.svelte";
export let data: any;
console.log(data.response);
async function nav(loc: string) {
goto(`/worldtravel/${loc}`);
}
</script>
<h1>Country List</h1>
{#each data.response as item}
<button class="btn btn-primary" on:click={() => nav(item.country_code)}
>{item.name}</button
>
<!-- <p>Name: {item.name}, Continent: {item.continent}</p> -->
{/each}