const cron = require('node-cron');
const { saveBranchResultsToFinancialSummary } = require('./financialSummaryController'); // Adjust the path based on your project structure

const { getSummary } = require('./autoCalculationController'); // Adjust the path based on your project structure


// npm install node-cron

// Top-level async wrapper
exports.runSummarySaving = async (req, res) => {
  try {
    const branchResults = await getSummary();  // Correct use of await inside async function
        await saveBranchResultsToFinancialSummary(branchResults);
      } catch (error) {
    console.error('Error saving summary:', error);
  }
};
