refactor: remove verbose debug logging from cospend API endpoints

Removed excessive console.log statements from recurring payments processing and monthly expenses aggregation. Error logging (console.error) is retained for troubleshooting.
This commit is contained in:
2025-12-16 16:40:34 +01:00
parent acc65c8320
commit 40a795a30b
3 changed files with 2 additions and 13 deletions

View File

@@ -18,11 +18,10 @@ export const POST: RequestHandler = async ({ request }) => {
}
await dbConnect();
try {
const now = new Date();
console.log(`[Cron] Starting recurring payments processing at ${now.toISOString()}`);
// Find all active recurring payments that are due
const duePayments = await RecurringPayment.find({
isActive: true,
@@ -34,16 +33,12 @@ export const POST: RequestHandler = async ({ request }) => {
]
});
console.log(`[Cron] Found ${duePayments.length} due recurring payments`);
const results = [];
let successCount = 0;
let failureCount = 0;
for (const recurringPayment of duePayments) {
try {
console.log(`[Cron] Processing recurring payment: ${recurringPayment.title} (${recurringPayment._id})`);
// Create the payment
const payment = await Payment.create({
title: `${recurringPayment.title} (Auto)`,
@@ -89,8 +84,6 @@ export const POST: RequestHandler = async ({ request }) => {
success: true
});
console.log(`[Cron] Successfully processed: ${recurringPayment.title}, next execution: ${nextExecutionDate.toISOString()}`);
} catch (paymentError) {
console.error(`[Cron] Error processing recurring payment ${recurringPayment._id}:`, paymentError);
failureCount++;
@@ -104,8 +97,6 @@ export const POST: RequestHandler = async ({ request }) => {
}
}
console.log(`[Cron] Completed processing. Success: ${successCount}, Failures: ${failureCount}`);
return json({
success: true,
timestamp: now.toISOString(),