From 2e1c57438c8798c4e74191b322f8b9bda985451f Mon Sep 17 00:00:00 2001 From: Ahmed Bouhuolia Date: Tue, 21 Jan 2025 11:53:29 +0200 Subject: [PATCH] refactor: reports to nestjs --- .../src/modules/BankingMatching/_utils.ts | 2 +- .../queries/GetMatchedTransactions.service.ts | 2 +- .../models/UncategorizedBankTransaction.ts | 2 +- .../commands/BillDTOTransformer.service.ts | 2 +- .../modules/Bills/commands/OpenBill.service.ts | 2 +- .../commands/CreateEditCustomerDTO.service.ts | 2 +- .../DynamicFilterRoleAbstractor.ts | 2 +- .../modules/Expenses/models/Expense.model.ts | 2 +- .../common/FinancialDateRanges.ts | 2 +- .../common/FinancialTablePreviousPeriod.ts | 4 ++-- .../common/FinancialTablePreviousYear.ts | 2 +- .../ARAgingSummary/ARAgingSummary.controller.ts | 5 ++++- .../ARAgingSummary/ARAgingSummary.module.ts | 7 ++++++- .../ARAgingSummary/ARAgingSummaryApplication.ts | 5 +---- .../ARAgingSummary/ARAgingSummaryRepository.ts | 2 +- .../modules/ARAgingSummary/utils.ts | 2 +- .../modules/AgingSummary/AgingReport.ts | 2 +- .../modules/AgingSummary/AgingSummary.module.ts | 2 ++ .../modules/AgingSummary/AgingSummaryMeta.ts | 2 +- .../CustomerBalanceSummaryMeta.ts | 2 +- .../modules/GeneralLedger/GeneralLedgerMeta.ts | 4 ++-- .../GeneralLedger/GeneralLedgerRepository.ts | 2 +- .../InventoryItemDetailsRepository.ts | 2 +- .../InventoryValuationSheet.module.ts | 9 +++++++++ .../InventoryValuationSheet/_constants.ts | 2 ++ .../modules/SalesByItems/SalesByItemsMeta.ts | 17 ++++++++--------- .../TransactionsByContactTableRows.ts | 2 +- .../modules/Import/ImportRemoveExpiredFiles.ts | 2 +- .../server-nest/src/modules/Import/_utils.ts | 2 +- .../models/InventoryCostLotTracker.ts | 3 ++- .../commands/ConvetSaleEstimate.service.ts | 2 +- .../commands/DeliverSaleEstimate.service.ts | 2 +- .../SaleEstimates/models/SaleEstimate.ts | 2 +- .../commands/CloseSaleReceipt.service.ts | 2 +- .../SaleReceiptDTOTransformer.service.ts | 2 +- .../modules/Subscription/SubscriptionPeriod.ts | 3 ++- .../Subscription/models/PlanSubscription.ts | 2 +- .../guards/TransactionsLockingGuard.ts | 3 ++- .../VendorCreditDTOTransform.service.ts | 2 +- .../Vendors/commands/CreateEditVendorDTO.ts | 2 +- .../src/utils/transform-to-map-key-value.ts | 1 + 41 files changed, 71 insertions(+), 50 deletions(-) diff --git a/packages/server-nest/src/modules/BankingMatching/_utils.ts b/packages/server-nest/src/modules/BankingMatching/_utils.ts index 65563de39..6d269911e 100644 --- a/packages/server-nest/src/modules/BankingMatching/_utils.ts +++ b/packages/server-nest/src/modules/BankingMatching/_utils.ts @@ -1,4 +1,4 @@ -import moment from 'moment'; +import * as moment from 'moment'; import * as R from 'ramda'; import { isEmpty, sumBy } from 'lodash'; import { ERRORS, MatchedTransactionPOJO } from './types'; diff --git a/packages/server-nest/src/modules/BankingMatching/queries/GetMatchedTransactions.service.ts b/packages/server-nest/src/modules/BankingMatching/queries/GetMatchedTransactions.service.ts index b806fe97e..70c6f27ca 100644 --- a/packages/server-nest/src/modules/BankingMatching/queries/GetMatchedTransactions.service.ts +++ b/packages/server-nest/src/modules/BankingMatching/queries/GetMatchedTransactions.service.ts @@ -1,5 +1,5 @@ import * as R from 'ramda'; -import moment from 'moment'; +import * as moment from 'moment'; import { first, sumBy } from 'lodash'; import { PromisePool } from '@supercharge/promise-pool'; import { Inject, Injectable } from '@nestjs/common'; diff --git a/packages/server-nest/src/modules/BankingTransactions/models/UncategorizedBankTransaction.ts b/packages/server-nest/src/modules/BankingTransactions/models/UncategorizedBankTransaction.ts index cfcb15fef..eced57060 100644 --- a/packages/server-nest/src/modules/BankingTransactions/models/UncategorizedBankTransaction.ts +++ b/packages/server-nest/src/modules/BankingTransactions/models/UncategorizedBankTransaction.ts @@ -1,5 +1,5 @@ /* eslint-disable global-require */ -import moment from 'moment'; +import * as moment from 'moment'; import { Model } from 'objection'; // import TenantModel from 'models/TenantModel'; // import ModelSettings from './ModelSetting'; diff --git a/packages/server-nest/src/modules/Bills/commands/BillDTOTransformer.service.ts b/packages/server-nest/src/modules/Bills/commands/BillDTOTransformer.service.ts index 38719dca1..d832544fb 100644 --- a/packages/server-nest/src/modules/Bills/commands/BillDTOTransformer.service.ts +++ b/packages/server-nest/src/modules/Bills/commands/BillDTOTransformer.service.ts @@ -1,6 +1,6 @@ import { Inject, Injectable } from '@nestjs/common'; import { omit, sumBy } from 'lodash'; -import moment from 'moment'; +import * as moment from 'moment'; import * as R from 'ramda'; import * as composeAsync from 'async/compose'; import { formatDateFields } from '@/utils/format-date-fields'; diff --git a/packages/server-nest/src/modules/Bills/commands/OpenBill.service.ts b/packages/server-nest/src/modules/Bills/commands/OpenBill.service.ts index 6b9dd899d..4317fc66b 100644 --- a/packages/server-nest/src/modules/Bills/commands/OpenBill.service.ts +++ b/packages/server-nest/src/modules/Bills/commands/OpenBill.service.ts @@ -1,4 +1,4 @@ -import moment from 'moment'; +import * as moment from 'moment'; import { Inject, Injectable } from '@nestjs/common'; import { ERRORS } from '../Bills.constants'; import { BillsValidators } from './BillsValidators.service'; diff --git a/packages/server-nest/src/modules/Customers/commands/CreateEditCustomerDTO.service.ts b/packages/server-nest/src/modules/Customers/commands/CreateEditCustomerDTO.service.ts index 09017abc4..4a2605eec 100644 --- a/packages/server-nest/src/modules/Customers/commands/CreateEditCustomerDTO.service.ts +++ b/packages/server-nest/src/modules/Customers/commands/CreateEditCustomerDTO.service.ts @@ -1,4 +1,4 @@ -import moment from 'moment'; +import * as moment from 'moment'; import { defaultTo, omit, isEmpty } from 'lodash'; import { Injectable } from '@nestjs/common'; import { TenancyContext } from '@/modules/Tenancy/TenancyContext.service'; diff --git a/packages/server-nest/src/modules/DynamicListing/DynamicFilter/DynamicFilterRoleAbstractor.ts b/packages/server-nest/src/modules/DynamicListing/DynamicFilter/DynamicFilterRoleAbstractor.ts index 47453caa3..28e939e46 100644 --- a/packages/server-nest/src/modules/DynamicListing/DynamicFilter/DynamicFilterRoleAbstractor.ts +++ b/packages/server-nest/src/modules/DynamicListing/DynamicFilter/DynamicFilterRoleAbstractor.ts @@ -1,5 +1,5 @@ // @ts-nocheck -import moment from 'moment'; +import * as moment from 'moment'; import * as R from 'ramda'; import { IFilterRole, IDynamicFilter } from './DynamicFilter.types'; import { Parser } from '@/libs/logic-evaluation/Parser'; diff --git a/packages/server-nest/src/modules/Expenses/models/Expense.model.ts b/packages/server-nest/src/modules/Expenses/models/Expense.model.ts index 04da1f635..34630d9df 100644 --- a/packages/server-nest/src/modules/Expenses/models/Expense.model.ts +++ b/packages/server-nest/src/modules/Expenses/models/Expense.model.ts @@ -1,5 +1,5 @@ import { Model, raw } from 'objection'; -import moment from 'moment'; +import * as moment from 'moment'; import { ExpenseCategory } from './ExpenseCategory.model'; import { Account } from '@/modules/Accounts/models/Account.model'; import { TenantBaseModel } from '@/modules/System/models/TenantBaseModel'; diff --git a/packages/server-nest/src/modules/FinancialStatements/common/FinancialDateRanges.ts b/packages/server-nest/src/modules/FinancialStatements/common/FinancialDateRanges.ts index cf568b62b..26a0287e6 100644 --- a/packages/server-nest/src/modules/FinancialStatements/common/FinancialDateRanges.ts +++ b/packages/server-nest/src/modules/FinancialStatements/common/FinancialDateRanges.ts @@ -1,4 +1,4 @@ -import moment from 'moment'; +import * as moment from 'moment'; import { IDateRange, IFinancialDatePeriodsUnit } from '../types/Report.types'; import { GConstructor } from '@/common/types/Constructor'; import { FinancialSheet } from './FinancialSheet'; diff --git a/packages/server-nest/src/modules/FinancialStatements/common/FinancialTablePreviousPeriod.ts b/packages/server-nest/src/modules/FinancialStatements/common/FinancialTablePreviousPeriod.ts index c5cafbf29..9fb653c17 100644 --- a/packages/server-nest/src/modules/FinancialStatements/common/FinancialTablePreviousPeriod.ts +++ b/packages/server-nest/src/modules/FinancialStatements/common/FinancialTablePreviousPeriod.ts @@ -1,7 +1,7 @@ -import moment from 'moment'; +import * as moment from 'moment'; import { ITableColumn, ITableColumnAccessor } from '../types/Table.types'; import { IDateRange } from '../types/Report.types'; -import { Constructor, GConstructor } from '@/common/types/Constructor'; +import { GConstructor } from '@/common/types/Constructor'; import { I18nService } from 'nestjs-i18n'; import { FinancialSheet } from './FinancialSheet'; diff --git a/packages/server-nest/src/modules/FinancialStatements/common/FinancialTablePreviousYear.ts b/packages/server-nest/src/modules/FinancialStatements/common/FinancialTablePreviousYear.ts index 6787b7357..989ab1e91 100644 --- a/packages/server-nest/src/modules/FinancialStatements/common/FinancialTablePreviousYear.ts +++ b/packages/server-nest/src/modules/FinancialStatements/common/FinancialTablePreviousYear.ts @@ -1,4 +1,4 @@ -import moment from 'moment'; +import * as moment from 'moment'; import { ITableColumn, ITableColumnAccessor } from '../types/Table.types'; import { IDateRange } from '../types/Report.types'; import { GConstructor } from '@/common/types/Constructor'; diff --git a/packages/server-nest/src/modules/FinancialStatements/modules/ARAgingSummary/ARAgingSummary.controller.ts b/packages/server-nest/src/modules/FinancialStatements/modules/ARAgingSummary/ARAgingSummary.controller.ts index a3e41529a..d9453d77f 100644 --- a/packages/server-nest/src/modules/FinancialStatements/modules/ARAgingSummary/ARAgingSummary.controller.ts +++ b/packages/server-nest/src/modules/FinancialStatements/modules/ARAgingSummary/ARAgingSummary.controller.ts @@ -1,10 +1,13 @@ import { IARAgingSummaryQuery } from './ARAgingSummary.types'; -import { Get, Headers } from '@nestjs/common'; +import { Controller, Get, Headers } from '@nestjs/common'; import { Query, Res } from '@nestjs/common'; import { ARAgingSummaryApplication } from './ARAgingSummaryApplication'; import { AcceptType } from '@/constants/accept-type'; import { Response } from 'express'; +import { PublicRoute } from '@/modules/Auth/Jwt.guard'; +@Controller('reports/receivable-aging-summary') +@PublicRoute() export class ARAgingSummaryController { constructor(private readonly ARAgingSummaryApp: ARAgingSummaryApplication) {} diff --git a/packages/server-nest/src/modules/FinancialStatements/modules/ARAgingSummary/ARAgingSummary.module.ts b/packages/server-nest/src/modules/FinancialStatements/modules/ARAgingSummary/ARAgingSummary.module.ts index 98ff39b73..86afd8601 100644 --- a/packages/server-nest/src/modules/FinancialStatements/modules/ARAgingSummary/ARAgingSummary.module.ts +++ b/packages/server-nest/src/modules/FinancialStatements/modules/ARAgingSummary/ARAgingSummary.module.ts @@ -7,9 +7,12 @@ import { AgingSummaryModule } from '../AgingSummary/AgingSummary.module'; import { ARAgingSummaryRepository } from './ARAgingSummaryRepository'; import { ARAgingSummaryApplication } from './ARAgingSummaryApplication'; import { ARAgingSummaryController } from './ARAgingSummary.controller'; +import { ARAgingSummaryMeta } from './ARAgingSummaryMeta'; +import { FinancialSheetCommonModule } from '../../common/FinancialSheetCommon.module'; +import { TenancyContext } from '@/modules/Tenancy/TenancyContext.service'; @Module({ - imports: [AgingSummaryModule], + imports: [AgingSummaryModule, FinancialSheetCommonModule], controllers: [ARAgingSummaryController], providers: [ ARAgingSummaryTableInjectable, @@ -18,6 +21,8 @@ import { ARAgingSummaryController } from './ARAgingSummary.controller'; ARAgingSummaryPdfInjectable, ARAgingSummaryRepository, ARAgingSummaryApplication, + ARAgingSummaryMeta, + TenancyContext, ], }) export class ARAgingSummaryModule {} diff --git a/packages/server-nest/src/modules/FinancialStatements/modules/ARAgingSummary/ARAgingSummaryApplication.ts b/packages/server-nest/src/modules/FinancialStatements/modules/ARAgingSummary/ARAgingSummaryApplication.ts index 908e29163..382e70c3c 100644 --- a/packages/server-nest/src/modules/FinancialStatements/modules/ARAgingSummary/ARAgingSummaryApplication.ts +++ b/packages/server-nest/src/modules/FinancialStatements/modules/ARAgingSummary/ARAgingSummaryApplication.ts @@ -16,7 +16,7 @@ export class ARAgingSummaryApplication { /** * Retrieve the A/R aging summary sheet. - * @param {IAPAgingSummaryQuery} query + * @param {IARAgingSummaryQuery} query */ public sheet(query: IARAgingSummaryQuery) { return this.ARAgingSummarySheet.ARAgingSummary(query); @@ -24,7 +24,6 @@ export class ARAgingSummaryApplication { /** * Retrieve the A/R aging summary in table format. - * @param {number} tenantId * @param {IAPAgingSummaryQuery} query */ public table(query: IARAgingSummaryQuery) { @@ -33,7 +32,6 @@ export class ARAgingSummaryApplication { /** * Retrieve the A/R aging summary in XLSX format. - * @param {number} tenantId * @param {IAPAgingSummaryQuery} query */ public xlsx(query: IARAgingSummaryQuery) { @@ -42,7 +40,6 @@ export class ARAgingSummaryApplication { /** * Retrieve the A/R aging summary in CSV format. - * @param {number} tenantId * @param {IAPAgingSummaryQuery} query */ public csv(query: IARAgingSummaryQuery) { diff --git a/packages/server-nest/src/modules/FinancialStatements/modules/ARAgingSummary/ARAgingSummaryRepository.ts b/packages/server-nest/src/modules/FinancialStatements/modules/ARAgingSummary/ARAgingSummaryRepository.ts index 5fc175cb9..f56ae6fbb 100644 --- a/packages/server-nest/src/modules/FinancialStatements/modules/ARAgingSummary/ARAgingSummaryRepository.ts +++ b/packages/server-nest/src/modules/FinancialStatements/modules/ARAgingSummary/ARAgingSummaryRepository.ts @@ -1,10 +1,10 @@ +import { Inject } from '@nestjs/common'; import { isEmpty, groupBy } from 'lodash'; import { Customer } from '@/modules/Customers/models/Customer'; import { SaleInvoice } from '@/modules/SaleInvoices/models/SaleInvoice'; import { ModelObject } from 'objection'; import { IARAgingSummaryQuery } from './ARAgingSummary.types'; import { TenancyContext } from '@/modules/Tenancy/TenancyContext.service'; -import { Inject } from '@nestjs/common'; export class ARAgingSummaryRepository { @Inject(TenancyContext) diff --git a/packages/server-nest/src/modules/FinancialStatements/modules/ARAgingSummary/utils.ts b/packages/server-nest/src/modules/FinancialStatements/modules/ARAgingSummary/utils.ts index 674f81928..1e2fcdcd3 100644 --- a/packages/server-nest/src/modules/FinancialStatements/modules/ARAgingSummary/utils.ts +++ b/packages/server-nest/src/modules/FinancialStatements/modules/ARAgingSummary/utils.ts @@ -1,4 +1,4 @@ - +import * as moment from 'moment'; export const getARAgingSummaryDefaultQuery = () => { diff --git a/packages/server-nest/src/modules/FinancialStatements/modules/AgingSummary/AgingReport.ts b/packages/server-nest/src/modules/FinancialStatements/modules/AgingSummary/AgingReport.ts index 2f2cfe310..ac4f7dc1f 100644 --- a/packages/server-nest/src/modules/FinancialStatements/modules/AgingSummary/AgingReport.ts +++ b/packages/server-nest/src/modules/FinancialStatements/modules/AgingSummary/AgingReport.ts @@ -2,7 +2,7 @@ import * as moment from 'moment'; import { IAgingPeriod } from './AgingSummary.types'; import { FinancialSheet } from '../../common/FinancialSheet'; -export abstract class AgingReport extends FinancialSheet { +export class AgingReport extends FinancialSheet { /** * Retrieve the aging periods range. * @param {string} asDay diff --git a/packages/server-nest/src/modules/FinancialStatements/modules/AgingSummary/AgingSummary.module.ts b/packages/server-nest/src/modules/FinancialStatements/modules/AgingSummary/AgingSummary.module.ts index ce88d5764..428dd9d2c 100644 --- a/packages/server-nest/src/modules/FinancialStatements/modules/AgingSummary/AgingSummary.module.ts +++ b/packages/server-nest/src/modules/FinancialStatements/modules/AgingSummary/AgingSummary.module.ts @@ -1,7 +1,9 @@ import { Module } from '@nestjs/common'; import { AgingSummaryMeta } from './AgingSummaryMeta'; +import { FinancialSheetCommonModule } from '../../common/FinancialSheetCommon.module'; @Module({ + imports: [FinancialSheetCommonModule], exports: [AgingSummaryMeta], providers: [AgingSummaryMeta], }) diff --git a/packages/server-nest/src/modules/FinancialStatements/modules/AgingSummary/AgingSummaryMeta.ts b/packages/server-nest/src/modules/FinancialStatements/modules/AgingSummary/AgingSummaryMeta.ts index e3bf32736..e6c2b1a11 100644 --- a/packages/server-nest/src/modules/FinancialStatements/modules/AgingSummary/AgingSummaryMeta.ts +++ b/packages/server-nest/src/modules/FinancialStatements/modules/AgingSummary/AgingSummaryMeta.ts @@ -1,4 +1,4 @@ -import moment from 'moment'; +import * as moment from 'moment'; import { Injectable } from '@nestjs/common'; import { FinancialSheetMeta } from '../../common/FinancialSheetMeta'; import { IAgingSummaryMeta, IAgingSummaryQuery } from './AgingSummary.types'; diff --git a/packages/server-nest/src/modules/FinancialStatements/modules/CustomerBalanceSummary/CustomerBalanceSummaryMeta.ts b/packages/server-nest/src/modules/FinancialStatements/modules/CustomerBalanceSummary/CustomerBalanceSummaryMeta.ts index 66ec0b586..0d3018fab 100644 --- a/packages/server-nest/src/modules/FinancialStatements/modules/CustomerBalanceSummary/CustomerBalanceSummaryMeta.ts +++ b/packages/server-nest/src/modules/FinancialStatements/modules/CustomerBalanceSummary/CustomerBalanceSummaryMeta.ts @@ -1,4 +1,4 @@ -import moment from 'moment'; +import * as moment from 'moment'; import { ICustomerBalanceSummaryMeta, ICustomerBalanceSummaryQuery, diff --git a/packages/server-nest/src/modules/FinancialStatements/modules/GeneralLedger/GeneralLedgerMeta.ts b/packages/server-nest/src/modules/FinancialStatements/modules/GeneralLedger/GeneralLedgerMeta.ts index 93dd8d0a0..544ee9537 100644 --- a/packages/server-nest/src/modules/FinancialStatements/modules/GeneralLedger/GeneralLedgerMeta.ts +++ b/packages/server-nest/src/modules/FinancialStatements/modules/GeneralLedger/GeneralLedgerMeta.ts @@ -1,9 +1,9 @@ +import * as moment from 'moment'; +import { Injectable } from '@nestjs/common'; import { IGeneralLedgerMeta, IGeneralLedgerSheetQuery, } from './GeneralLedger.types'; -import moment from 'moment'; -import { Injectable } from '@nestjs/common'; import { FinancialSheetMeta } from '../../common/FinancialSheetMeta'; @Injectable() diff --git a/packages/server-nest/src/modules/FinancialStatements/modules/GeneralLedger/GeneralLedgerRepository.ts b/packages/server-nest/src/modules/FinancialStatements/modules/GeneralLedger/GeneralLedgerRepository.ts index b01091c65..9a2581f42 100644 --- a/packages/server-nest/src/modules/FinancialStatements/modules/GeneralLedger/GeneralLedgerRepository.ts +++ b/packages/server-nest/src/modules/FinancialStatements/modules/GeneralLedger/GeneralLedgerRepository.ts @@ -1,4 +1,4 @@ -import moment from 'moment'; +import * as moment from 'moment'; import * as R from 'ramda'; import { IGeneralLedgerSheetQuery, diff --git a/packages/server-nest/src/modules/FinancialStatements/modules/InventoryItemDetails/InventoryItemDetailsRepository.ts b/packages/server-nest/src/modules/FinancialStatements/modules/InventoryItemDetails/InventoryItemDetailsRepository.ts index bcbf40c6a..ccc3adde8 100644 --- a/packages/server-nest/src/modules/FinancialStatements/modules/InventoryItemDetails/InventoryItemDetailsRepository.ts +++ b/packages/server-nest/src/modules/FinancialStatements/modules/InventoryItemDetails/InventoryItemDetailsRepository.ts @@ -1,6 +1,6 @@ import { ModelObject, raw } from 'objection'; import { isEmpty } from 'lodash'; -import moment from 'moment'; +import * as moment from 'moment'; import { IInventoryDetailsQuery } from './InventoryItemDetails.types'; import { Item } from '@/modules/Items/models/Item'; import { InventoryTransaction } from '@/modules/InventoryCost/models/InventoryTransaction'; diff --git a/packages/server-nest/src/modules/FinancialStatements/modules/InventoryValuationSheet/InventoryValuationSheet.module.ts b/packages/server-nest/src/modules/FinancialStatements/modules/InventoryValuationSheet/InventoryValuationSheet.module.ts index b80464e09..b882647f3 100644 --- a/packages/server-nest/src/modules/FinancialStatements/modules/InventoryValuationSheet/InventoryValuationSheet.module.ts +++ b/packages/server-nest/src/modules/FinancialStatements/modules/InventoryValuationSheet/InventoryValuationSheet.module.ts @@ -5,14 +5,23 @@ import { InventoryValuationMetaInjectable } from './InventoryValuationSheetMeta' import { InventoryValuationController } from './InventoryValuation.controller'; import { InventoryValuationSheetService } from './InventoryValuationSheetService'; import { InventoryValuationSheetApplication } from './InventoryValuationSheetApplication'; +import { FinancialSheetCommonModule } from '../../common/FinancialSheetCommon.module'; +import { InventoryValuationSheetRepository } from './InventoryValuationSheetRepository'; +import { InventoryValuationSheetExportable } from './InventoryValuationSheetExportable'; +import { InventoryCostModule } from '@/modules/InventoryCost/InventoryCost.module'; +import { TenancyContext } from '@/modules/Tenancy/TenancyContext.service'; @Module({ + imports: [FinancialSheetCommonModule, InventoryCostModule], providers: [ InventoryValuationSheetPdf, InventoryValuationSheetTableInjectable, InventoryValuationMetaInjectable, InventoryValuationSheetService, InventoryValuationSheetApplication, + InventoryValuationSheetRepository, + InventoryValuationSheetExportable, + TenancyContext ], controllers: [InventoryValuationController], exports: [InventoryValuationSheetApplication], diff --git a/packages/server-nest/src/modules/FinancialStatements/modules/InventoryValuationSheet/_constants.ts b/packages/server-nest/src/modules/FinancialStatements/modules/InventoryValuationSheet/_constants.ts index 09c379f2d..48642f347 100644 --- a/packages/server-nest/src/modules/FinancialStatements/modules/InventoryValuationSheet/_constants.ts +++ b/packages/server-nest/src/modules/FinancialStatements/modules/InventoryValuationSheet/_constants.ts @@ -1,3 +1,5 @@ +import * as moment from 'moment'; + export enum ROW_TYPE { ITEM = 'ITEM', TOTAL = 'TOTAL', diff --git a/packages/server-nest/src/modules/FinancialStatements/modules/SalesByItems/SalesByItemsMeta.ts b/packages/server-nest/src/modules/FinancialStatements/modules/SalesByItems/SalesByItemsMeta.ts index 40a8827c1..a34f53fbe 100644 --- a/packages/server-nest/src/modules/FinancialStatements/modules/SalesByItems/SalesByItemsMeta.ts +++ b/packages/server-nest/src/modules/FinancialStatements/modules/SalesByItems/SalesByItemsMeta.ts @@ -1,22 +1,21 @@ -import moment from 'moment'; -import { FinancialSheetMeta } from '../../common/FinancialSheetMeta'; -import { ISalesByItemsReportQuery, ISalesByItemsSheetMeta } from './SalesByItems.types'; +import * as moment from 'moment'; import { Injectable } from '@nestjs/common'; -import { I18nService } from 'nestjs-i18n'; +import { FinancialSheetMeta } from '../../common/FinancialSheetMeta'; +import { + ISalesByItemsReportQuery, + ISalesByItemsSheetMeta, +} from './SalesByItems.types'; @Injectable() export class SalesByItemsMeta { - constructor( - private financialSheetMeta: FinancialSheetMeta, - private i18n: I18nService, - ) {} + constructor(private financialSheetMeta: FinancialSheetMeta) {} /** * Retrieve the sales by items meta. * @returns {IBalanceSheetMeta} */ public async meta( - query: ISalesByItemsReportQuery + query: ISalesByItemsReportQuery, ): Promise { const commonMeta = await this.financialSheetMeta.meta(); const formattedToDate = moment(query.toDate).format('YYYY/MM/DD'); diff --git a/packages/server-nest/src/modules/FinancialStatements/modules/TransactionsByContact/TransactionsByContactTableRows.ts b/packages/server-nest/src/modules/FinancialStatements/modules/TransactionsByContact/TransactionsByContactTableRows.ts index c4dfe80df..e131f6678 100644 --- a/packages/server-nest/src/modules/FinancialStatements/modules/TransactionsByContact/TransactionsByContactTableRows.ts +++ b/packages/server-nest/src/modules/FinancialStatements/modules/TransactionsByContact/TransactionsByContactTableRows.ts @@ -1,4 +1,4 @@ -import moment from 'moment'; +import * as moment from 'moment'; import * as R from 'ramda'; import { ITransactionsByContactsContact } from './TransactionsByContact.types'; import { ITableRow } from '../../types/Table.types'; diff --git a/packages/server-nest/src/modules/Import/ImportRemoveExpiredFiles.ts b/packages/server-nest/src/modules/Import/ImportRemoveExpiredFiles.ts index 84a2a1ca6..d89f46db6 100644 --- a/packages/server-nest/src/modules/Import/ImportRemoveExpiredFiles.ts +++ b/packages/server-nest/src/modules/Import/ImportRemoveExpiredFiles.ts @@ -1,4 +1,4 @@ -import moment from 'moment'; +import * as moment from 'moment'; import bluebird from 'bluebird'; import { deleteImportFile } from './_utils'; import { Injectable } from '@nestjs/common'; diff --git a/packages/server-nest/src/modules/Import/_utils.ts b/packages/server-nest/src/modules/Import/_utils.ts index df3ff1a15..43c80c912 100644 --- a/packages/server-nest/src/modules/Import/_utils.ts +++ b/packages/server-nest/src/modules/Import/_utils.ts @@ -1,5 +1,5 @@ import * as Yup from 'yup'; -import moment from 'moment'; +import * as moment from 'moment'; import * as R from 'ramda'; import { Knex } from 'knex'; import fs from 'fs/promises'; diff --git a/packages/server-nest/src/modules/InventoryCost/models/InventoryCostLotTracker.ts b/packages/server-nest/src/modules/InventoryCost/models/InventoryCostLotTracker.ts index 4703f1ded..fa3219c5c 100644 --- a/packages/server-nest/src/modules/InventoryCost/models/InventoryCostLotTracker.ts +++ b/packages/server-nest/src/modules/InventoryCost/models/InventoryCostLotTracker.ts @@ -1,6 +1,7 @@ import { Model } from 'objection'; import { castArray } from 'lodash'; -import moment, { unitOfTime } from 'moment'; +import * as moment from 'moment'; +import { unitOfTime } from 'moment'; import { SaleInvoice } from '@/modules/SaleInvoices/models/SaleInvoice'; import { SaleReceipt } from '@/modules/SaleReceipts/models/SaleReceipt'; import { Item } from '@/modules/Items/models/Item'; diff --git a/packages/server-nest/src/modules/SaleEstimates/commands/ConvetSaleEstimate.service.ts b/packages/server-nest/src/modules/SaleEstimates/commands/ConvetSaleEstimate.service.ts index b6abd3d99..8e71ebc92 100644 --- a/packages/server-nest/src/modules/SaleEstimates/commands/ConvetSaleEstimate.service.ts +++ b/packages/server-nest/src/modules/SaleEstimates/commands/ConvetSaleEstimate.service.ts @@ -1,7 +1,7 @@ +import * as moment from 'moment'; import { Inject, Injectable } from '@nestjs/common'; import { EventEmitter2 } from '@nestjs/event-emitter'; import { Knex } from 'knex'; -import moment from 'moment'; import { SaleEstimate } from '../models/SaleEstimate'; import { events } from '@/common/events/events'; diff --git a/packages/server-nest/src/modules/SaleEstimates/commands/DeliverSaleEstimate.service.ts b/packages/server-nest/src/modules/SaleEstimates/commands/DeliverSaleEstimate.service.ts index c0c05cf1e..d0e89e31c 100644 --- a/packages/server-nest/src/modules/SaleEstimates/commands/DeliverSaleEstimate.service.ts +++ b/packages/server-nest/src/modules/SaleEstimates/commands/DeliverSaleEstimate.service.ts @@ -1,5 +1,5 @@ import { Knex } from 'knex'; -import moment from 'moment'; +import * as moment from 'moment'; import { Inject, Injectable } from '@nestjs/common'; import { EventEmitter2 } from '@nestjs/event-emitter'; import { diff --git a/packages/server-nest/src/modules/SaleEstimates/models/SaleEstimate.ts b/packages/server-nest/src/modules/SaleEstimates/models/SaleEstimate.ts index bbf019bd1..611881f8f 100644 --- a/packages/server-nest/src/modules/SaleEstimates/models/SaleEstimate.ts +++ b/packages/server-nest/src/modules/SaleEstimates/models/SaleEstimate.ts @@ -1,4 +1,4 @@ -import moment from 'moment'; +import * as moment from 'moment'; import { Model } from 'objection'; import { Injectable } from '@nestjs/common'; import { TenantBaseModel } from '@/modules/System/models/TenantBaseModel'; diff --git a/packages/server-nest/src/modules/SaleReceipts/commands/CloseSaleReceipt.service.ts b/packages/server-nest/src/modules/SaleReceipts/commands/CloseSaleReceipt.service.ts index 2b93f06b5..99ced01f8 100644 --- a/packages/server-nest/src/modules/SaleReceipts/commands/CloseSaleReceipt.service.ts +++ b/packages/server-nest/src/modules/SaleReceipts/commands/CloseSaleReceipt.service.ts @@ -1,5 +1,5 @@ import { Inject, Injectable } from '@nestjs/common'; -import moment from 'moment'; +import * as moment from 'moment'; import { Knex } from 'knex'; import { ISaleReceiptEventClosedPayload, diff --git a/packages/server-nest/src/modules/SaleReceipts/commands/SaleReceiptDTOTransformer.service.ts b/packages/server-nest/src/modules/SaleReceipts/commands/SaleReceiptDTOTransformer.service.ts index 4ea9f9ac5..6f13b1055 100644 --- a/packages/server-nest/src/modules/SaleReceipts/commands/SaleReceiptDTOTransformer.service.ts +++ b/packages/server-nest/src/modules/SaleReceipts/commands/SaleReceiptDTOTransformer.service.ts @@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common'; import * as R from 'ramda'; import { sumBy, omit } from 'lodash'; import * as composeAsync from 'async/compose'; -import moment from 'moment'; +import * as moment from 'moment'; import { SaleReceiptIncrement } from './SaleReceiptIncrement.service'; import { ItemsEntriesService } from '@/modules/Items/ItemsEntries.service'; import { BranchTransactionDTOTransformer } from '@/modules/Branches/integrations/BranchTransactionDTOTransform'; diff --git a/packages/server-nest/src/modules/Subscription/SubscriptionPeriod.ts b/packages/server-nest/src/modules/Subscription/SubscriptionPeriod.ts index 0cdf46804..4570c46af 100644 --- a/packages/server-nest/src/modules/Subscription/SubscriptionPeriod.ts +++ b/packages/server-nest/src/modules/Subscription/SubscriptionPeriod.ts @@ -1,4 +1,5 @@ -import moment, { unitOfTime } from 'moment'; +import * as moment from 'moment'; +import { unitOfTime } from 'moment'; export class SubscriptionPeriod { private start: Date; diff --git a/packages/server-nest/src/modules/Subscription/models/PlanSubscription.ts b/packages/server-nest/src/modules/Subscription/models/PlanSubscription.ts index f71953914..2112af793 100644 --- a/packages/server-nest/src/modules/Subscription/models/PlanSubscription.ts +++ b/packages/server-nest/src/modules/Subscription/models/PlanSubscription.ts @@ -1,5 +1,5 @@ import { Model, mixin } from 'objection'; -import moment from 'moment'; +import * as moment from 'moment'; import { SubscriptionPeriod } from '../SubscriptionPeriod'; import { SystemModel } from '@/modules/System/models/SystemModel'; import { SubscriptionPaymentStatus } from '@/interfaces/SubscriptionPlan'; diff --git a/packages/server-nest/src/modules/TransactionsLocking/guards/TransactionsLockingGuard.ts b/packages/server-nest/src/modules/TransactionsLocking/guards/TransactionsLockingGuard.ts index e8aa2de20..edfc99060 100644 --- a/packages/server-nest/src/modules/TransactionsLocking/guards/TransactionsLockingGuard.ts +++ b/packages/server-nest/src/modules/TransactionsLocking/guards/TransactionsLockingGuard.ts @@ -1,4 +1,5 @@ -import moment, { MomentInput } from 'moment'; +import * as moment from 'moment'; +import { MomentInput } from 'moment'; import { Injectable } from '@nestjs/common'; import { TransactionsLockingGroup } from '../types/TransactionsLocking.types'; import { TransactionsLockingRepository } from '../TransactionsLockingRepository'; diff --git a/packages/server-nest/src/modules/VendorCredit/commands/VendorCreditDTOTransform.service.ts b/packages/server-nest/src/modules/VendorCredit/commands/VendorCreditDTOTransform.service.ts index 579e3542e..e74e2cd6d 100644 --- a/packages/server-nest/src/modules/VendorCredit/commands/VendorCreditDTOTransform.service.ts +++ b/packages/server-nest/src/modules/VendorCredit/commands/VendorCreditDTOTransform.service.ts @@ -1,4 +1,4 @@ -import moment from 'moment'; +import * as moment from 'moment'; import { omit } from 'lodash'; import * as R from 'ramda'; import { ERRORS } from '../constants'; diff --git a/packages/server-nest/src/modules/Vendors/commands/CreateEditVendorDTO.ts b/packages/server-nest/src/modules/Vendors/commands/CreateEditVendorDTO.ts index ed8aa2925..000643683 100644 --- a/packages/server-nest/src/modules/Vendors/commands/CreateEditVendorDTO.ts +++ b/packages/server-nest/src/modules/Vendors/commands/CreateEditVendorDTO.ts @@ -1,4 +1,4 @@ -import moment from 'moment'; +import * as moment from 'moment'; import { defaultTo, isEmpty } from 'lodash'; import { Injectable } from '@nestjs/common'; import { IVendorEditDTO, IVendorNewDTO } from '../types/Vendors.types'; diff --git a/packages/server-nest/src/utils/transform-to-map-key-value.ts b/packages/server-nest/src/utils/transform-to-map-key-value.ts index f70d623a1..1190948b2 100644 --- a/packages/server-nest/src/utils/transform-to-map-key-value.ts +++ b/packages/server-nest/src/utils/transform-to-map-key-value.ts @@ -2,5 +2,6 @@ export const transformToMapKeyValue = ( collection: T[], key: keyof T, ): Map => { + // @ts-ignore return new Map(collection.map((item) => [item[key], item])); };