refactor: replace drizzle count with $count (#2471)

This commit is contained in:
Meier Lukas
2025-03-02 10:54:44 +01:00
committed by GitHub
parent 9eb76634d0
commit d66610b324
5 changed files with 11 additions and 22 deletions

View File

@@ -2,7 +2,6 @@ import type { AnySQLiteTable } from "drizzle-orm/sqlite-core";
import { isProviderEnabled } from "@homarr/auth/server";
import type { Database } from "@homarr/db";
import { count } from "@homarr/db";
import { apps, boards, groups, integrations, invites, users } from "@homarr/db/schema";
import { createTRPCRouter, publicProcedure } from "../trpc";
@@ -28,5 +27,5 @@ const getCountForTableAsync = async (db: Database, table: AnySQLiteTable, canVie
return 0;
}
return (await db.select({ count: count() }).from(table))[0]?.count ?? 0;
return await db.$count(table);
};