fix admin
This commit is contained in:
parent
e384937596
commit
e143587404
@ -1,9 +1,9 @@
|
||||
import { db, Guestbook } from 'astro:db';
|
||||
import { db } from "db";
|
||||
import { guestbookTable } from "./schema";
|
||||
|
||||
// https://astro.build/db/seed
|
||||
export default async function seed() {
|
||||
await db.insert(Guestbook).values([
|
||||
{ id: 1, username: "test user", message: "this is a message!", published: new Date("2025-05-01") },
|
||||
await db.insert(guestbookTable).values([
|
||||
{ id: 1, username: "test user", message: "this is a message!" },
|
||||
{ id: 2, username: "heylo", website: "https://world.org", message: "hiii!!" },
|
||||
]);
|
||||
}
|
||||
|
@ -3,7 +3,9 @@ export const prerender = false;
|
||||
|
||||
import { Font } from "astro:assets";
|
||||
import { actions } from "astro:actions";
|
||||
import { db, desc, Guestbook } from "astro:db";
|
||||
import { desc } from "drizzle-orm";
|
||||
import { db } from "db";
|
||||
import { guestbookTable } from "db/schema";
|
||||
|
||||
import Layout from "@/layouts/Layout.astro";
|
||||
import formatDate from "@/utils/formatDate";
|
||||
@ -14,7 +16,7 @@ if (!import.meta.env.DEV) {
|
||||
return Astro.redirect("/guestbook");
|
||||
}
|
||||
|
||||
const entries = await db.select().from(Guestbook).orderBy(desc(Guestbook.published));
|
||||
const entries = await db.select().from(guestbookTable).orderBy(desc(guestbookTable.published));
|
||||
---
|
||||
<Layout title="guestbook admin">
|
||||
<Fragment slot="head">
|
||||
|
@ -3,7 +3,7 @@ import utc from "dayjs/plugin/utc";
|
||||
|
||||
dayjs.extend(utc);
|
||||
|
||||
export default function (date: string, iso = false, format?: string) {
|
||||
export default function (date: Date | string, iso = false, format?: string) {
|
||||
if (iso) {
|
||||
return dayjs(date).utc(true).toISOString();
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user