fix: return wrong response

This commit is contained in:
Ahmed Bouhuolia
2025-05-11 00:40:43 +02:00
parent a42143a996
commit 9ebd967fe7
23 changed files with 153 additions and 215 deletions

View File

@@ -21,7 +21,7 @@ export class APAgingSummaryController {
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
const table = await this.APAgingSummaryApp.table(filter);
return res.status(200).send(table);
res.status(200).send(table);
// Retrieves the csv format.
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
const csv = await this.APAgingSummaryApp.csv(filter);
@@ -29,7 +29,7 @@ export class APAgingSummaryController {
res.setHeader('Content-Disposition', 'attachment; filename=output.csv');
res.setHeader('Content-Type', 'text/csv');
return res.send(csv);
res.send(csv);
// Retrieves the xlsx format.
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
const buffer = await this.APAgingSummaryApp.xlsx(filter);
@@ -39,7 +39,7 @@ export class APAgingSummaryController {
'Content-Type',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
);
return res.send(buffer);
res.send(buffer);
// Retrieves the pdf format.
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
const pdfContent = await this.APAgingSummaryApp.pdf(filter);
@@ -48,12 +48,12 @@ export class APAgingSummaryController {
'Content-Type': 'application/pdf',
'Content-Length': pdfContent.length,
});
return res.send(pdfContent);
res.send(pdfContent);
// Retrieves the json format.
} else {
const sheet = await this.APAgingSummaryApp.sheet(filter);
return res.status(200).send(sheet);
res.status(200).send(sheet);
}
}
}

View File

@@ -27,12 +27,12 @@ export class ARAgingSummaryController {
'Content-Type',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
);
return res.send(buffer);
res.send(buffer);
// Retrieves the table format.
} else if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
const table = await this.ARAgingSummaryApp.table(filter);
return res.status(200).send(table);
res.status(200).send(table);
// Retrieves the csv format.
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
const buffer = await this.ARAgingSummaryApp.csv(filter);
@@ -40,7 +40,7 @@ export class ARAgingSummaryController {
res.setHeader('Content-Disposition', 'attachment; filename=output.csv');
res.setHeader('Content-Type', 'text/csv');
return res.send(buffer);
res.send(buffer);
// Retrieves the pdf format.
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
const pdfContent = await this.ARAgingSummaryApp.pdf(filter);
@@ -49,12 +49,12 @@ export class ARAgingSummaryController {
'Content-Type': 'application/pdf',
'Content-Length': pdfContent.length,
});
return res.send(pdfContent);
res.send(pdfContent);
// Retrieves the json format.
} else {
const sheet = await this.ARAgingSummaryApp.sheet(filter);
return res.status(200).send(sheet);
res.status(200).send(sheet);
}
}
}

View File

@@ -28,7 +28,7 @@ export class BalanceSheetStatementController {
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
const table = await this.balanceSheetApp.table(query);
return res.status(200).send(table);
res.status(200).send(table);
// Retrieves the csv format.
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
const buffer = await this.balanceSheetApp.csv(query);
@@ -36,7 +36,7 @@ export class BalanceSheetStatementController {
res.setHeader('Content-Disposition', 'attachment; filename=output.csv');
res.setHeader('Content-Type', 'text/csv');
return res.send(buffer);
res.send(buffer);
// Retrieves the xlsx format.
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
const buffer = await this.balanceSheetApp.xlsx(query);
@@ -46,7 +46,7 @@ export class BalanceSheetStatementController {
'Content-Type',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
);
return res.send(buffer);
res.send(buffer);
// Retrieves the pdf format.
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
const pdfContent = await this.balanceSheetApp.pdf(query);
@@ -59,7 +59,7 @@ export class BalanceSheetStatementController {
} else {
const sheet = await this.balanceSheetApp.sheet(query);
return res.status(200).send(sheet);
res.status(200).send(sheet);
}
}
}

View File

@@ -22,7 +22,7 @@ export class CashflowController {
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
const table = await this.cashflowSheetApp.table(query);
return res.status(200).send(table);
res.status(200).send(table);
// Retrieves the csv format.
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
const buffer = await this.cashflowSheetApp.csv(query);
@@ -30,7 +30,7 @@ export class CashflowController {
res.setHeader('Content-Disposition', 'attachment; filename=output.csv');
res.setHeader('Content-Type', 'text/csv');
return res.status(200).send(buffer);
res.status(200).send(buffer);
// Retrieves the pdf format.
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
const buffer = await this.cashflowSheetApp.xlsx(query);
@@ -40,7 +40,7 @@ export class CashflowController {
'Content-Type',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
);
return res.send(buffer);
res.send(buffer);
// Retrieves the pdf format.
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
const pdfContent = await this.cashflowSheetApp.pdf(query);
@@ -49,12 +49,12 @@ export class CashflowController {
'Content-Type': 'application/pdf',
'Content-Length': pdfContent.length,
});
return res.send(pdfContent);
res.send(pdfContent);
// Retrieves the json format.
} else {
const cashflow = await this.cashflowSheetApp.sheet(query);
return res.status(200).send(cashflow);
res.status(200).send(cashflow);
}
}
}

View File

@@ -28,18 +28,18 @@ export class CustomerBalanceSummaryController {
'Content-Type',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
);
return res.send(buffer);
res.send(buffer);
// Retrieves the csv format.
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
const buffer = await this.customerBalanceSummaryApp.csv(filter);
res.setHeader('Content-Disposition', 'attachment; filename=output.csv');
res.setHeader('Content-Type', 'text/csv');
return res.send(buffer);
res.send(buffer);
// Retrieves the json table format.
} else if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
const table = await this.customerBalanceSummaryApp.table(filter);
return res.status(200).send(table);
res.status(200).send(table);
// Retrieves the pdf format.
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
const buffer = await this.customerBalanceSummaryApp.pdf(filter);
@@ -48,11 +48,11 @@ export class CustomerBalanceSummaryController {
'Content-Type': 'application/pdf',
'Content-Length': buffer.length,
});
return res.send(buffer);
res.send(buffer);
// Retrieves the json format.
} else {
const sheet = await this.customerBalanceSummaryApp.sheet(filter);
return res.status(200).send(sheet);
res.status(200).send(sheet);
}
}
}

View File

@@ -24,7 +24,7 @@ export class GeneralLedgerController {
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
const table = await this.generalLedgerApplication.table(query);
return res.status(200).send(table);
res.status(200).send(table);
// Retrieves the csv format.
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
const buffer = await this.generalLedgerApplication.csv(query);
@@ -32,7 +32,7 @@ export class GeneralLedgerController {
res.setHeader('Content-Disposition', 'attachment; filename=output.csv');
res.setHeader('Content-Type', 'text/csv');
return res.send(buffer);
res.send(buffer);
// Retrieves the xlsx format.
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
const buffer = await this.generalLedgerApplication.xlsx(query);
@@ -42,7 +42,7 @@ export class GeneralLedgerController {
'Content-Type',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
);
return res.send(buffer);
res.send(buffer);
// Retrieves the pdf format.
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
const pdfContent = await this.generalLedgerApplication.pdf(query);
@@ -50,12 +50,12 @@ export class GeneralLedgerController {
'Content-Type': 'application/pdf',
'Content-Length': pdfContent.length,
});
return res.send(pdfContent);
res.send(pdfContent);
// Retrieves the json format.
} else {
const sheet = await this.generalLedgerApplication.sheet(query);
return res.status(200).send(sheet);
res.status(200).send(sheet);
}
}
}

View File

@@ -25,7 +25,7 @@ export class InventoryItemDetailsController {
res.setHeader('Content-Disposition', 'attachment; filename=output.csv');
res.setHeader('Content-Type', 'text/csv');
return res.send(buffer);
res.send(buffer);
// Retrieves the xlsx format.
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
const buffer = await this.inventoryItemDetailsApp.xlsx(query);
@@ -35,11 +35,11 @@ export class InventoryItemDetailsController {
'Content-Type',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
);
return res.send(buffer);
res.send(buffer);
// Retrieves the json table format.
} else if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
const table = await this.inventoryItemDetailsApp.table(query);
return res.status(200).send(table);
res.status(200).send(table);
// Retrieves the pdf format.
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
const buffer = await this.inventoryItemDetailsApp.pdf(query);
@@ -48,11 +48,11 @@ export class InventoryItemDetailsController {
'Content-Type': 'application/pdf',
'Content-Length': buffer.length,
});
return res.send(buffer);
res.send(buffer);
} else {
const sheet = await this.inventoryItemDetailsApp.sheet(query);
return res.status(200).send(sheet);
res.status(200).send(sheet);
}
}
}

View File

@@ -27,7 +27,7 @@ export class InventoryValuationController {
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
const table = await this.inventoryValuationApp.table(query);
return res.status(200).send(table);
res.status(200).send(table);
// Retrieves the csv format.
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
const buffer = await this.inventoryValuationApp.csv(query);
@@ -35,7 +35,7 @@ export class InventoryValuationController {
res.setHeader('Content-Disposition', 'attachment; filename=output.csv');
res.setHeader('Content-Type', 'text/csv');
return res.send(buffer);
res.send(buffer);
// Retrieves the xslx buffer format.
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
const buffer = await this.inventoryValuationApp.xlsx(query);
@@ -45,7 +45,7 @@ export class InventoryValuationController {
'Content-Type',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
);
return res.send(buffer);
res.send(buffer);
// Retrieves the pdf format.
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
const pdfContent = await this.inventoryValuationApp.pdf(query);
@@ -54,12 +54,12 @@ export class InventoryValuationController {
'Content-Type': 'application/pdf',
'Content-Length': pdfContent.length,
});
return res.status(200).send(pdfContent);
res.status(200).send(pdfContent);
// Retrieves the json format.
} else {
const sheet = await this.inventoryValuationApp.sheet(query);
return res.status(200).send(sheet);
res.status(200).send(sheet);
}
}
}

View File

@@ -21,7 +21,7 @@ export class JournalSheetController {
// Retrieves the json table format.
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
const table = await this.journalSheetApp.table(query);
return res.status(200).send(table);
res.status(200).send(table);
// Retrieves the csv format.
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
@@ -30,7 +30,7 @@ export class JournalSheetController {
res.setHeader('Content-Disposition', 'attachment; filename=output.csv');
res.setHeader('Content-Type', 'text/csv');
return res.send(buffer);
res.send(buffer);
// Retrieves the xlsx format.
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
const buffer = await this.journalSheetApp.xlsx(query);
@@ -40,7 +40,7 @@ export class JournalSheetController {
'Content-Type',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
);
return res.send(buffer);
res.send(buffer);
// Retrieves the json format.
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
const pdfContent = await this.journalSheetApp.pdf(query);
@@ -53,7 +53,7 @@ export class JournalSheetController {
} else {
const sheet = await this.journalSheetApp.sheet(query);
return res.status(200).send(sheet);
res.status(200).send(sheet);
}
}
}

View File

@@ -33,12 +33,12 @@ export class ProfitLossSheetController {
res.setHeader('Content-Disposition', 'attachment; filename=output.csv');
res.setHeader('Content-Type', 'text/csv');
return res.send(sheet);
res.send(sheet);
// Retrieves the json table format.
} else if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
const table = await this.profitLossSheetApp.table(query);
return res.status(200).send(table);
res.status(200).send(table);
// Retrieves the xlsx format.
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
const sheet = await this.profitLossSheetApp.xlsx(query);
@@ -48,7 +48,7 @@ export class ProfitLossSheetController {
'Content-Type',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
);
return res.send(sheet);
res.send(sheet);
// Retrieves the json format.
} else if (acceptHeader.includes(AcceptType.ApplicationJson)) {
const pdfContent = await this.profitLossSheetApp.pdf(query);
@@ -57,11 +57,11 @@ export class ProfitLossSheetController {
'Content-Type': 'application/pdf',
'Content-Length': pdfContent.length,
});
return res.send(pdfContent);
res.send(pdfContent);
} else {
const sheet = await this.profitLossSheetApp.sheet(query);
return res.status(200).send(sheet);
res.status(200).send(sheet);
}
}
}

View File

@@ -24,7 +24,7 @@ export class PurchasesByItemReportController {
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
const table = await this.purchasesByItemsApp.table(filter);
return res.status(200).send(table);
res.status(200).send(table);
// CSV response format.
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
const buffer = await this.purchasesByItemsApp.csv(filter);
@@ -32,7 +32,7 @@ export class PurchasesByItemReportController {
res.setHeader('Content-Disposition', 'attachment; filename=output.csv');
res.setHeader('Content-Type', 'text/csv');
return res.send(buffer);
res.send(buffer);
// Xlsx response format.
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
const buffer = await this.purchasesByItemsApp.xlsx(filter);
@@ -42,7 +42,7 @@ export class PurchasesByItemReportController {
'Content-Type',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
);
return res.send(buffer);
res.send(buffer);
// PDF response format.
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
const pdfContent = await this.purchasesByItemsApp.pdf(filter);
@@ -51,12 +51,12 @@ export class PurchasesByItemReportController {
'Content-Type': 'application/pdf',
'Content-Length': pdfContent.length,
});
return res.send(pdfContent);
res.send(pdfContent);
// Json response format.
} else {
const sheet = await this.purchasesByItemsApp.sheet(filter);
return res.status(200).send(sheet);
res.status(200).send(sheet);
}
}
}

View File

@@ -33,12 +33,12 @@ export class SalesByItemsController {
res.setHeader('Content-Disposition', 'attachment; filename=output.csv');
res.setHeader('Content-Type', 'text/csv');
return res.send(buffer);
res.send(buffer);
// Retrieves the json table format.
} else if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
const table = await this.salesByItemsApp.table(filter);
return res.status(200).send(table);
res.status(200).send(table);
// Retrieves the xlsx format.
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
const buffer = this.salesByItemsApp.xlsx(filter);
@@ -48,7 +48,7 @@ export class SalesByItemsController {
'Content-Type',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
);
return res.send(buffer);
res.send(buffer);
// Retrieves the json format.
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
const pdfContent = await this.salesByItemsApp.pdf(filter);
@@ -57,10 +57,10 @@ export class SalesByItemsController {
'Content-Type': 'application/pdf',
'Content-Length': pdfContent.length,
});
return res.send(pdfContent);
res.send(pdfContent);
} else {
const sheet = await this.salesByItemsApp.sheet(filter);
return res.status(200).send(sheet);
res.status(200).send(sheet);
}
}
}

View File

@@ -26,7 +26,7 @@ export class SalesTaxLiabilitySummaryController {
// Retrieves the json table format.
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
const table = await this.salesTaxLiabilitySummaryApp.table(query);
return res.status(200).send(table);
res.status(200).send(table);
// Retrieves the xlsx format.
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
const buffer = await this.salesTaxLiabilitySummaryApp.xlsx(query);
@@ -35,14 +35,14 @@ export class SalesTaxLiabilitySummaryController {
'Content-Type',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
);
return res.send(buffer);
res.send(buffer);
// Retrieves the csv format.
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
const buffer = await this.salesTaxLiabilitySummaryApp.csv(query);
res.setHeader('Content-Disposition', 'attachment; filename=output.csv');
res.setHeader('Content-Type', 'text/csv');
return res.send(buffer);
res.send(buffer);
// Retrieves the json format.
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
const pdfContent = await this.salesTaxLiabilitySummaryApp.pdf(query);
@@ -50,10 +50,10 @@ export class SalesTaxLiabilitySummaryController {
'Content-Type': 'application/pdf',
'Content-Length': pdfContent.length,
});
return res.status(200).send(pdfContent);
res.status(200).send(pdfContent);
} else {
const sheet = await this.salesTaxLiabilitySummaryApp.sheet(query);
return res.status(200).send(sheet);
res.status(200).send(sheet);
}
}
}

View File

@@ -23,7 +23,7 @@ export class TransactionsByCustomerController {
// Retrieves the json table format.
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
const table = await this.transactionsByCustomersApp.table(filter);
return res.status(200).send(table);
res.status(200).send(table);
// Retrieve the csv format.
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
@@ -32,7 +32,7 @@ export class TransactionsByCustomerController {
res.setHeader('Content-Disposition', 'attachment; filename=output.csv');
res.setHeader('Content-Type', 'text/csv');
return res.send(csv);
res.send(csv);
// Retrieve the xlsx format.
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
@@ -42,7 +42,7 @@ export class TransactionsByCustomerController {
'Content-Type',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
);
return res.send(buffer);
res.send(buffer);
// Retrieve the json format.
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
@@ -51,10 +51,10 @@ export class TransactionsByCustomerController {
'Content-Type': 'application/pdf',
'Content-Length': pdfContent.length,
});
return res.send(pdfContent);
res.send(pdfContent);
} else {
const sheet = await this.transactionsByCustomersApp.sheet(filter);
return res.status(200).send(sheet);
res.status(200).send(sheet);
}
}
}

View File

@@ -27,7 +27,7 @@ export class TransactionsByVendorController {
res.setHeader('Content-Type', 'application/vnd.openxmlformats');
res.setHeader('Content-Disposition', 'attachment; filename=report.xlsx');
return res.send(buffer);
res.send(buffer);
// Retrieves the csv format.
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
const buffer = await this.transactionsByVendorsApp.csv(filter);
@@ -35,12 +35,12 @@ export class TransactionsByVendorController {
res.setHeader('Content-Type', 'text/csv');
res.setHeader('Content-Disposition', 'attachment; filename=report.csv');
return res.send(buffer);
res.send(buffer);
// Retrieves the json table format.
} else if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
const table = await this.transactionsByVendorsApp.table(filter);
return res.status(200).send(table);
res.status(200).send(table);
// Retrieves the pdf format.
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
const pdfContent = await this.transactionsByVendorsApp.pdf(filter);
@@ -48,11 +48,11 @@ export class TransactionsByVendorController {
'Content-Type': 'application/pdf',
'Content-Length': pdfContent.length,
});
return res.send(pdfContent);
res.send(pdfContent);
// Retrieves the json format.
} else {
const sheet = await this.transactionsByVendorsApp.sheet(filter);
return res.status(200).send(sheet);
res.status(200).send(sheet);
}
}
}

View File

@@ -29,7 +29,7 @@ export class TrialBalanceSheetController {
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
const { table, meta, query } =
await this.trialBalanceSheetApp.table(filter);
return res.status(200).send({ table, meta, query });
res.status(200).send({ table, meta, query });
// Retrieves in xlsx format
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
const buffer = await this.trialBalanceSheetApp.xlsx(filter);
@@ -38,7 +38,7 @@ export class TrialBalanceSheetController {
'Content-Type',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
);
return res.send(buffer);
res.send(buffer);
// Retrieves in csv format.
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
const buffer = await this.trialBalanceSheetApp.csv(filter);
@@ -46,7 +46,7 @@ export class TrialBalanceSheetController {
res.setHeader('Content-Disposition', 'attachment; filename=output.csv');
res.setHeader('Content-Type', 'text/csv');
return res.send(buffer);
res.send(buffer);
// Retrieves in pdf format.
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
const pdfContent = await this.trialBalanceSheetApp.pdf(filter);
@@ -59,7 +59,7 @@ export class TrialBalanceSheetController {
} else {
const { data, query, meta } =
await this.trialBalanceSheetApp.sheet(filter);
return res.status(200).send({ data, query, meta });
res.status(200).send({ data, query, meta });
}
}
}

View File

@@ -27,20 +27,20 @@ export class VendorBalanceSummaryController {
res.setHeader('Content-Disposition', 'attachment; filename=output.csv');
res.setHeader('Content-Type', 'text/csv');
return res.send(buffer);
res.send(buffer);
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
const buffer = await this.vendorBalanceSummaryApp.xlsx(filter);
res.setHeader('Content-Disposition', 'attachment; filename=output.xlsx');
res.setHeader('Content-Type', 'application/vnd.openxmlformats');
return res.send(buffer);
res.send(buffer);
// Retrieves the json table format.
} else if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
const table = await this.vendorBalanceSummaryApp.table(filter);
return res.status(200).send(table);
res.status(200).send(table);
// Retrieves the pdf format.
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
const pdfContent = await this.vendorBalanceSummaryApp.pdf(filter);
@@ -49,11 +49,11 @@ export class VendorBalanceSummaryController {
'Content-Type': 'application/pdf',
'Content-Length': pdfContent.length,
});
return res.send(pdfContent);
res.send(pdfContent);
// Retrieves the json format.
} else {
const sheet = await this.vendorBalanceSummaryApp.sheet(filter);
return res.status(200).send(sheet);
res.status(200).send(sheet);
}
}
}