From e11e2f631711cdc81841a26d519400115137937e Mon Sep 17 00:00:00 2001 From: xurxodev Date: Sat, 16 Dec 2023 14:16:42 +0100 Subject: [PATCH] refactor: order functions according to execution flow --- .../ProductExportSpreadsheetRepository.ts | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/data/repositories/ProductExportSpreadsheetRepository.ts b/src/data/repositories/ProductExportSpreadsheetRepository.ts index 6e387a8..99256ee 100644 --- a/src/data/repositories/ProductExportSpreadsheetRepository.ts +++ b/src/data/repositories/ProductExportSpreadsheetRepository.ts @@ -47,19 +47,6 @@ export class ProductExportSpreadsheetRepository implements ProductExportReposito this.saveWorkbook(wb, workbook.name); } - private buildExcelWorkbook(workbook: Workbook) { - const wb = new ExcelJS.Workbook(); - - workbook.sheets.forEach(sheet => { - const sh = wb.addWorksheet(sheet.name); - - sh.addRow(sheet.columns); - sh.addRows(sheet.rows); - }); - - return wb; - } - private splitProducts(products: Product[]) { const productsSortedByTitle = _c(products) .uniqWith((product1, product2) => product1.equals(product2)) @@ -105,6 +92,19 @@ export class ProductExportSpreadsheetRepository implements ProductExportReposito }; } + private buildExcelWorkbook(workbook: Workbook) { + const wb = new ExcelJS.Workbook(); + + workbook.sheets.forEach(sheet => { + const sh = wb.addWorksheet(sheet.name); + + sh.addRow(sheet.columns); + sh.addRows(sheet.rows); + }); + + return wb; + } + protected async saveWorkbook(wb: ExcelJS.Workbook, name: string): Promise { wb.xlsx.writeFile(name); }