feat: add ReconcileDateRangeCard to settings page; enhance date picker layout in statistics and transaction filters components
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 1m24s
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 1m24s
This commit is contained in:
@@ -245,4 +245,32 @@ export const transactionService = {
|
||||
duplicatesFound: duplicatesToDelete.length,
|
||||
};
|
||||
},
|
||||
|
||||
async reconcileByDateRange(
|
||||
startDate: string | undefined,
|
||||
endDate: string,
|
||||
reconciled: boolean = true,
|
||||
): Promise<{ updatedCount: number }> {
|
||||
// Update all transactions in the date range
|
||||
// If startDate is not provided, use a very old date to include all transactions up to endDate
|
||||
const whereClause: {
|
||||
date: { lte: string; gte?: string };
|
||||
isReconciled: boolean;
|
||||
} = {
|
||||
date: {
|
||||
lte: endDate,
|
||||
...(startDate && { gte: startDate }),
|
||||
},
|
||||
isReconciled: !reconciled, // Only update transactions that don't already have the target state
|
||||
};
|
||||
|
||||
const result = await prisma.transaction.updateMany({
|
||||
where: whereClause,
|
||||
data: {
|
||||
isReconciled: reconciled,
|
||||
},
|
||||
});
|
||||
|
||||
return { updatedCount: result.count };
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user