feat: bugfixes, spedup, bulk actions,

This commit is contained in:
Vasily Zubarev
2025-03-17 18:36:25 +01:00
parent b27f07043e
commit 14967e1c85
34 changed files with 433 additions and 225 deletions

View File

@@ -2,11 +2,7 @@ import { prisma } from "@/lib/db"
import { calcTotalPerCurrency } from "@/lib/stats"
import { Prisma } from "@prisma/client"
import { cache } from "react"
export type StatsFilters = {
dateFrom?: string
dateTo?: string
}
import { TransactionFilters } from "./transactions"
export type DashboardStats = {
totalIncomePerCurrency: Record<string, number>
@@ -15,7 +11,7 @@ export type DashboardStats = {
invoicesProcessed: number
}
export const getDashboardStats = cache(async (filters: StatsFilters = {}): Promise<DashboardStats> => {
export const getDashboardStats = cache(async (filters: TransactionFilters = {}): Promise<DashboardStats> => {
const where: Prisma.TransactionWhereInput = {}
if (filters.dateFrom || filters.dateTo) {
@@ -51,7 +47,7 @@ export type ProjectStats = {
invoicesProcessed: number
}
export const getProjectStats = cache(async (projectId: string, filters: StatsFilters = {}) => {
export const getProjectStats = cache(async (projectId: string, filters: TransactionFilters = {}) => {
const where: Prisma.TransactionWhereInput = {
projectCode: projectId,
}