server(theme): sort themes by total installs

This commit is contained in:
Abdullah Atta
2026-01-03 14:37:19 +05:00
parent 756bb82fb7
commit bf4d168c96

View File

@@ -30,7 +30,8 @@ export async function initializeDatabase(): Promise<Orama> {
colorScheme: "string",
compatibilityVersion: "number",
description: "string",
tags: "string[]"
tags: "string[]",
totalInstalls: "number"
},
id: "notesnook-themes"
});
@@ -60,6 +61,10 @@ export async function getThemes(query: (typeof ThemeQuerySchema)["_type"]) {
const count = query.limit;
const searchParams: SearchParams = {
sortBy: {
property: "totalInstalls",
order: "DESC"
},
where: {
compatibilityVersion: {
eq: query.compatibilityVersion