diff --git a/islands/PostView.tsx b/islands/PostView.tsx index 6a11435..986005b 100644 --- a/islands/PostView.tsx +++ b/islands/PostView.tsx @@ -196,7 +196,7 @@ export default function PostView( referrerpolicy="no-referrer" /> {post.name} diff --git a/routes/_middleware.ts b/routes/_middleware.ts index bdfcb15..a39f720 100644 --- a/routes/_middleware.ts +++ b/routes/_middleware.ts @@ -28,7 +28,9 @@ export async function handler( return new Response( `${ users.map((user) => - `${baseUrl}/users/${user.user_id}${ + `${baseUrl}/users/${ + user.account ?? user.user_id + }${ new Date(user.updated_at).toISOString() }` ).join("") + posts.map((post) => diff --git a/server/database.types.ts b/server/database.types.ts index c07f76e..6700e20 100644 --- a/server/database.types.ts +++ b/server/database.types.ts @@ -360,6 +360,7 @@ export type Database = { } user_view: { Row: { + account: string | null updated_at: string | null user_id: number | null } diff --git a/server/db.ts b/server/db.ts index 7f5ff91..5ae3d78 100644 --- a/server/db.ts +++ b/server/db.ts @@ -19,11 +19,13 @@ export type PostViewType = { source: string; updated_at: string; user_id: number; + account?: string | null; }; export type UserViewType = { user_id: number; updated_at: string; + account?: string | null; }; let supabase: SupabaseClient; @@ -87,7 +89,7 @@ export async function selectUser(userKey: string) { export async function selectUsers() { const { data, error } = await supabase.from("user_view").select( - "user_id,updated_at", + "user_id,updated_at,account", ).returns(); if (error) { throw error;