mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-05-09 02:51:46 +00:00
23 lines
551 B
TypeScript
23 lines
551 B
TypeScript
import { eq } from "drizzle-orm";
|
|
import { db, schema } from "@/lib/db";
|
|
|
|
export interface UserDashboardPreferences {
|
|
dashboardWidgets: string | 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,
|
|
};
|
|
}
|