mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-05-09 19:01:47 +00:00
refactor(core): move app para src e padroniza estrutura
This commit is contained in:
23
src/features/dashboard/preferences-queries.ts
Normal file
23
src/features/dashboard/preferences-queries.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { eq } from "drizzle-orm";
|
||||
import type { WidgetPreferences } from "@/features/dashboard/widgets/actions";
|
||||
import { db, schema } from "@/shared/lib/db";
|
||||
|
||||
export interface UserDashboardPreferences {
|
||||
dashboardWidgets: WidgetPreferences | null;
|
||||
}
|
||||
|
||||
export async function fetchUserDashboardPreferences(
|
||||
userId: string,
|
||||
): Promise<UserDashboardPreferences> {
|
||||
const result = await db
|
||||
.select({
|
||||
dashboardWidgets: schema.preferenciasUsuario.dashboardWidgets,
|
||||
})
|
||||
.from(schema.preferenciasUsuario)
|
||||
.where(eq(schema.preferenciasUsuario.userId, userId))
|
||||
.limit(1);
|
||||
|
||||
return {
|
||||
dashboardWidgets: result[0]?.dashboardWidgets ?? null,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user