From 5ca7ce75126303e9b1e8625ec6bad2b90c3dcc43 Mon Sep 17 00:00:00 2001 From: Rodrigo Luglio Date: Tue, 15 Oct 2024 07:16:34 -0300 Subject: [PATCH] order public themes by created date --- src/lib/db/themes.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/db/themes.ts b/src/lib/db/themes.ts index 87f8292..2691941 100644 --- a/src/lib/db/themes.ts +++ b/src/lib/db/themes.ts @@ -4,7 +4,7 @@ import { revalidatePath } from 'next/cache' import { ColorScheme, type SavedTheme, SavedThemeSchema } from '../types/colors' import { db } from '../drizzle/db' import { ThemesTable, UsersTable } from '../drizzle/schema' -import { eq } from 'drizzle-orm' +import { desc, eq } from 'drizzle-orm' import { generateVSIX } from '@/lib/generator/exportVSIX' import { sql } from '@vercel/postgres' @@ -13,6 +13,7 @@ export async function getPublicThemes(): Promise { .select() .from(ThemesTable) .where(eq(ThemesTable.public, true)) + .orderBy(desc(ThemesTable.createdAt)) return results.map(parseSavedTheme) }