mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-05-09 11:01:45 +00:00
Arquivos de queries, helpers e controllers dispersos na raiz de dashboard/ foram movidos para subdiretórios temáticos (bills/, invoices/, notes/, notifications/, overview/, payments/, goals-progress/, categories/). ~25 widgets monolíticos obsoletos removidos em favor de nova arquitetura baseada em widget-registry com components/widgets/. Novos componentes: category-breakdown-chart/list, goals-progress-item, percentage-change-indicator. Imports atualizados em fetch-dashboard-data e transaction-filters limpos. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
29 lines
774 B
TypeScript
29 lines
774 B
TypeScript
import { eq } from "drizzle-orm";
|
|
import { cacheLife, cacheTag } from "next/cache";
|
|
import type { WidgetPreferences } from "@/features/dashboard/widget-registry/widget-actions";
|
|
import { db, schema } from "@/shared/lib/db";
|
|
|
|
interface UserDashboardPreferences {
|
|
dashboardWidgets: WidgetPreferences | null;
|
|
}
|
|
|
|
export async function fetchUserDashboardPreferences(
|
|
userId: string,
|
|
): Promise<UserDashboardPreferences> {
|
|
"use cache";
|
|
cacheTag(`dashboard-${userId}`);
|
|
cacheLife({ revalidate: 3 });
|
|
|
|
const result = await db
|
|
.select({
|
|
dashboardWidgets: schema.userPreferences.dashboardWidgets,
|
|
})
|
|
.from(schema.userPreferences)
|
|
.where(eq(schema.userPreferences.userId, userId))
|
|
.limit(1);
|
|
|
|
return {
|
|
dashboardWidgets: result[0]?.dashboardWidgets ?? null,
|
|
};
|
|
}
|