This commit is contained in:
Ahmed Bouhuolia
2025-01-15 15:52:18 +02:00
parent 7bcd578c11
commit 271c46ea3b
24 changed files with 115 additions and 28 deletions

View File

@@ -24,6 +24,7 @@ export class AccountsController {
constructor(private readonly accountsApplication: AccountsApplication) {}
@Post()
@ApiOperation({ summary: 'Create an account' })
async createAccount(@Body() accountDTO: CreateAccountDTO) {
return this.accountsApplication.createAccount(accountDTO);
}

View File

@@ -10,9 +10,17 @@ import { BankAccountsController } from './BankAccounts.controller';
import { BankingPlaidModule } from '../BankingPlaid/BankingPlaid.module';
import { PlaidModule } from '../Plaid/Plaid.module';
import { BankRulesModule } from '../BankRules/BankRules.module';
import { BankingTransactionsRegonizeModule } from '../BankingTranasctionsRegonize/BankingTransactionsRegonize.module';
import { BankingTransactionsModule } from '../BankingTransactions/BankingTransactions.module';
@Module({
imports: [BankingPlaidModule, PlaidModule, BankRulesModule],
imports: [
BankingPlaidModule,
PlaidModule,
BankRulesModule,
BankingTransactionsRegonizeModule,
BankingTransactionsModule,
],
providers: [
DisconnectBankAccountService,
RefreshBankAccountService,
@@ -20,7 +28,7 @@ import { BankRulesModule } from '../BankRules/BankRules.module';
PauseBankAccountFeeds,
DeleteUncategorizedTransactionsOnAccountDeleting,
DisconnectPlaidItemOnAccountDeleted,
BankAccountsApplication
BankAccountsApplication,
],
exports: [BankAccountsApplication],
controllers: [BankAccountsController],

View File

@@ -1,3 +1,4 @@
// @ts-nocheck
import { Injectable, Inject } from '@nestjs/common';
import { BankAccount } from '../models/BankAccount';
import { DynamicListService } from '@/modules/DynamicListing/DynamicList.service';

View File

@@ -1,3 +1,4 @@
// @ts-nocheck
import { Knex } from 'knex';
import { Bill } from '../models/Bill';
import { Inject, Injectable } from '@nestjs/common';

View File

@@ -22,6 +22,8 @@ import { CreditNoteGLEntries } from './commands/CreditNoteGLEntries';
import { CreditNoteGLEntriesSubscriber } from './subscribers/CreditNoteGLEntriesSubscriber';
import { LedgerModule } from '../Ledger/Ledger.module';
import { AccountsModule } from '../Accounts/Accounts.module';
import { GetCreditNotesService } from './queries/GetCreditNotes.service';
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
@Module({
imports: [
@@ -33,7 +35,8 @@ import { AccountsModule } from '../Accounts/Accounts.module';
TemplateInjectableModule,
AutoIncrementOrdersModule,
LedgerModule,
AccountsModule
AccountsModule,
DynamicListModule
],
providers: [
CreateCreditNoteService,
@@ -43,6 +46,7 @@ import { AccountsModule } from '../Accounts/Accounts.module';
OpenCreditNoteService,
DeleteCreditNoteService,
GetCreditNotePdf,
GetCreditNotesService,
CreditNoteAutoIncrementService,
GetCreditNoteState,
CreditNoteApplication,

View File

@@ -1,3 +1,4 @@
// @ts-nocheck
import { Injectable } from '@nestjs/common';
import { InventoryTransactionsService } from '@/modules/InventoryCost/InventoryTransactions.service';
import { ItemsEntriesService } from '@/modules/Items/ItemsEntries.service';

View File

@@ -1,3 +1,4 @@
// @ts-nocheck
import { IDynamicFilter } from './DynamicFilter.types';
import { MetableModel } from '../types/DynamicList.types';

View File

@@ -1,3 +1,4 @@
// @ts-nocheck
import moment from 'moment';
import * as R from 'ramda';
import { IFilterRole, IDynamicFilter } from './DynamicFilter.types';

View File

@@ -18,13 +18,20 @@ import { InventoryAdjustmentInventoryTransactions } from './inventory/InventoryA
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
import { LedgerModule } from '../Ledger/Ledger.module';
import { TenancyContext } from '../Tenancy/TenancyContext.service';
import { InventoryCostModule } from '../InventoryCost/InventoryCost.module';
const models = [
RegisterTenancyModel(InventoryAdjustment),
RegisterTenancyModel(InventoryAdjustmentEntry),
];
@Module({
imports: [BranchesModule, WarehousesModule, LedgerModule, DynamicListModule],
imports: [
BranchesModule,
WarehousesModule,
LedgerModule,
DynamicListModule,
InventoryCostModule,
],
controllers: [InventoryAdjustmentsController],
providers: [
...models,
@@ -38,7 +45,7 @@ const models = [
InventoryAdjustmentsGLEntries,
TenancyContext,
InventoryAdjustmentInventoryTransactionsSubscriber,
InventoryAdjustmentInventoryTransactions
InventoryAdjustmentInventoryTransactions,
],
exports: [...models],
})

View File

@@ -22,8 +22,8 @@ const models = [
InventoryCostGLStorage,
InventoryItemsQuantitySyncService,
InventoryCostMethod,
InventoryTransactionsService
InventoryTransactionsService,
],
exports: [...models],
exports: [...models, InventoryTransactionsService],
})
export class InventoryCostModule {}

View File

@@ -1,14 +1,18 @@
import { IInventoryTransactionsDeletedPayload, TInventoryTransactionDirection } from './types/InventoryCost.types';
// @ts-nocheck
import { Knex } from 'knex';
import { Inject } from '@nestjs/common';
import { EventEmitter2 } from '@nestjs/event-emitter';
import {
IInventoryTransactionsDeletedPayload,
TInventoryTransactionDirection,
} from './types/InventoryCost.types';
import { InventoryCostLotTracker } from './models/InventoryCostLotTracker';
import { InventoryTransaction } from './models/InventoryTransaction';
import { Knex } from 'knex';
import { events } from '@/common/events/events';
import { IInventoryTransactionsCreatedPayload } from './types/InventoryCost.types';
import { transformItemEntriesToInventory } from "./utils";
import { transformItemEntriesToInventory } from './utils';
import { IItemEntryTransactionType } from '../TransactionItemEntry/ItemEntry.types';
import { ItemEntry } from '../TransactionItemEntry/models/ItemEntry';
import { Inject } from '@nestjs/common';
export class InventoryTransactionsService {
constructor(

View File

@@ -1,3 +1,4 @@
// @ts-nocheck
import { chain } from 'lodash';
import { pick } from 'lodash';
import { IItemEntryTransactionType } from '../TransactionItemEntry/ItemEntry.types';

View File

@@ -27,9 +27,13 @@ import { PaymentReceivedInvoiceSync } from './commands/PaymentReceivedInvoiceSyn
import { LedgerModule } from '../Ledger/Ledger.module';
import { AccountsModule } from '../Accounts/Accounts.module';
import { SendPaymentReceiveMailNotification } from './commands/PaymentReceivedMailNotification';
import { GetPaymentsReceivedService } from './queries/GetPaymentsReceived.service';
import { MailNotificationModule } from '../MailNotification/MailNotification.module';
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
import { MailModule } from '../Mail/Mail.module';
@Module({
controllers: [PaymentReceivesController],
controllers: [PaymentReceivesController,],
providers: [
PaymentReceivesApplication,
CreatePaymentReceivedService,
@@ -49,7 +53,8 @@ import { SendPaymentReceiveMailNotification } from './commands/PaymentReceivedMa
PaymentReceivedAutoIncrementSubscriber,
PaymentReceivedGLEntriesSubscriber,
PaymentReceivedSyncInvoicesSubscriber,
SendPaymentReceiveMailNotification
SendPaymentReceiveMailNotification,
GetPaymentsReceivedService
],
exports: [PaymentReceivesApplication, CreatePaymentReceivedService],
imports: [
@@ -60,7 +65,10 @@ import { SendPaymentReceiveMailNotification } from './commands/PaymentReceivedMa
PdfTemplatesModule,
AutoIncrementOrdersModule,
LedgerModule,
AccountsModule
AccountsModule,
MailNotificationModule,
DynamicListModule,
MailModule
],
})
export class PaymentsReceivedModule {}

View File

@@ -41,7 +41,7 @@ export class GetPaymentsReceivedService {
builder.withGraphFetched('depositAccount');
dynamicList.buildQuery()(builder);
filterDTO?.filterQuery && filterDTO.filterQuery(builder);
filterDTO?.filterQuery && filterDTO.filterQuery(builder as any);
})
.pagination(filter.page - 1, filter.pageSize);

View File

@@ -31,6 +31,8 @@ import { MailNotificationModule } from '../MailNotification/MailNotification.mod
import { MailModule } from '../Mail/Mail.module';
import { ChromiumlyTenancyModule } from '../ChromiumlyTenancy/ChromiumlyTenancy.module';
import { TemplateInjectableModule } from '../TemplateInjectable/TemplateInjectable.module';
import { SaleEstimatePdfTemplate } from '../SaleInvoices/queries/SaleEstimatePdfTemplate.service';
import { PdfTemplatesModule } from '../PdfTemplate/PdfTemplates.module';
// import { SaleEstimateNotifyBySms } from './commands/SaleEstimateSmsNotify';
@Module({
@@ -40,7 +42,8 @@ import { TemplateInjectableModule } from '../TemplateInjectable/TemplateInjectab
MailNotificationModule,
MailModule,
ChromiumlyTenancyModule,
TemplateInjectableModule
TemplateInjectableModule,
PdfTemplatesModule
],
controllers: [SaleEstimatesController],
providers: [
@@ -69,6 +72,7 @@ import { TemplateInjectableModule } from '../TemplateInjectable/TemplateInjectab
SaleEstimatesApplication,
SendSaleEstimateMail,
GetSaleEstimatePdf,
SaleEstimatePdfTemplate
// SaleEstimateNotifyBySms,
],
})

View File

@@ -33,11 +33,17 @@ import { InvoiceGLEntriesSubscriber } from './subscribers/InvoiceGLEntriesSubscr
import { SaleInvoiceGLEntries } from './ledger/InvoiceGLEntries';
import { LedgerModule } from '../Ledger/Ledger.module';
import { AccountsModule } from '../Accounts/Accounts.module';
import SaleInvoiceWriteoffSubscriber from './subscribers/SaleInvoiceWriteoffSubscriber';
import { SaleInvoiceWriteoffSubscriber } from './subscribers/SaleInvoiceWriteoffSubscriber';
import { SaleInvoiceWriteoffGLStorage } from './commands/writeoff/SaleInvoiceWriteoffGLStorage';
import { InvoiceInventoryTransactions } from './commands/inventory/InvoiceInventoryTransactions';
import { SendSaleEstimateMail } from '../SaleEstimates/commands/SendSaleEstimateMail';
import { MailModule } from '../Mail/Mail.module';
import { GetSaleInvoicesService } from './queries/GetSaleInvoices';
import { SendSaleInvoiceMail } from './commands/SendSaleInvoiceMail';
import { GetSaleInvoiceMailState } from './queries/GetSaleInvoiceMailState.service';
import { InventoryCostModule } from '../InventoryCost/InventoryCost.module';
import { SendSaleInvoiceMailCommon } from './commands/SendInvoiceInvoiceMailCommon.service';
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
import { MailNotificationModule } from '../MailNotification/MailNotification.module';
@Module({
imports: [
@@ -51,6 +57,9 @@ import { MailModule } from '../Mail/Mail.module';
LedgerModule,
AccountsModule,
MailModule,
MailNotificationModule,
InventoryCostModule,
DynamicListModule
],
controllers: [SaleInvoicesController],
providers: [
@@ -82,7 +91,10 @@ import { MailModule } from '../Mail/Mail.module';
SaleInvoiceWriteoffGLStorage,
SaleInvoiceWriteoffSubscriber,
InvoiceInventoryTransactions,
SendSaleEstimateMail,
SendSaleInvoiceMail,
GetSaleInvoicesService,
GetSaleInvoiceMailState,
SendSaleInvoiceMailCommon
],
})
export class SaleInvoicesModule {}

View File

@@ -1,3 +1,4 @@
// @ts-nocheck
import { InventoryTransactionsService } from '@/modules/InventoryCost/InventoryTransactions.service';
import { ItemsEntriesService } from '@/modules/Items/ItemsEntries.service';
import { Injectable } from '@nestjs/common';

View File

@@ -8,7 +8,7 @@ import { SaleInvoiceWriteoffGLStorage } from '../commands/writeoff/SaleInvoiceWr
import { events } from '@/common/events/events';
@Injectable()
export default class SaleInvoiceWriteoffSubscriber {
export class SaleInvoiceWriteoffSubscriber {
constructor(private readonly writeGLStorage: SaleInvoiceWriteoffGLStorage) {}
/**

View File

@@ -27,6 +27,11 @@ import { AccountsModule } from '../Accounts/Accounts.module';
import { SaleReceiptInventoryTransactionsSubscriber } from './inventory/SaleReceiptWriteInventoryTransactions';
import { GetSaleReceiptsService } from './queries/GetSaleReceipts.service';
import { SaleReceiptMailNotification } from './commands/SaleReceiptMailNotification';
import { SaleReceiptInventoryTransactions } from './inventory/SaleReceiptInventoryTransactions';
import { InventoryCostModule } from '../InventoryCost/InventoryCost.module';
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
import { MailModule } from '../Mail/Mail.module';
import { MailNotificationModule } from '../MailNotification/MailNotification.module';
@Module({
controllers: [SaleReceiptsController],
@@ -39,7 +44,11 @@ import { SaleReceiptMailNotification } from './commands/SaleReceiptMailNotificat
PdfTemplatesModule,
AutoIncrementOrdersModule,
LedgerModule,
AccountsModule
AccountsModule,
InventoryCostModule,
DynamicListModule,
MailModule,
MailNotificationModule
],
providers: [
TenancyContext,
@@ -57,9 +66,10 @@ import { SaleReceiptMailNotification } from './commands/SaleReceiptMailNotificat
SaleReceiptIncrement,
SaleReceiptGLEntries,
SaleReceiptGLEntriesSubscriber,
SaleReceiptInventoryTransactionsSubscriber,
GetSaleReceiptsService,
SaleReceiptMailNotification
SaleReceiptMailNotification,
SaleReceiptInventoryTransactions,
SaleReceiptInventoryTransactionsSubscriber,
],
})
export class SaleReceiptsModule {}

View File

@@ -1,14 +1,15 @@
// @ts-nocheck
import { Injectable } from '@nestjs/common';
import { Knex } from 'knex';
import { InventoryService } from '@/modules/InventoryCost/Inventory';
import { ItemsEntriesService } from '@/modules/Items/ItemsEntries.service';
import { SaleReceipt } from '../models/SaleReceipt';
import { InventoryTransactionsService } from '@/modules/InventoryCost/InventoryTransactions.service';
import { ItemsEntriesService } from '@/modules/Items/ItemsEntries.service';
@Injectable()
export class SaleReceiptInventoryTransactions {
constructor(
private readonly itemsEntriesService: ItemsEntriesService,
private readonly inventoryService: InventoryService,
private readonly inventoryService: InventoryTransactionsService,
) {}
/**

View File

@@ -6,8 +6,11 @@ import { ICancelTransactionsLockingDTO } from './types/TransactionsLocking.types
import { ITransactionLockingPartiallyDTO } from './types/TransactionsLocking.types';
import { QueryTransactionsLocking } from './queries/QueryTransactionsLocking';
import { PublicRoute } from '../Auth/Jwt.guard';
import { ApiOperation } from '@nestjs/swagger';
import { ApiTags } from '@nestjs/swagger';
@Controller('transactions-locking')
@ApiTags('Transactions Locking')
@PublicRoute()
export class TransactionsLockingController {
constructor(
@@ -16,6 +19,7 @@ export class TransactionsLockingController {
) {}
@Put('lock')
@ApiOperation({ summary: 'Lock all transactions for a module or all modules' })
async commandTransactionsLocking(
@Body('module') module: TransactionsLockingGroup,
@Body() transactionLockingDTO: ITransactionsLockingAllDTO,
@@ -32,6 +36,7 @@ export class TransactionsLockingController {
}
@Put('cancel-lock')
@ApiOperation({ summary: 'Cancel all transactions locking for a module or all modules' })
async cancelTransactionLocking(
@Body('module') module: TransactionsLockingGroup,
@Body() cancelLockingDTO: ICancelTransactionsLockingDTO,
@@ -47,6 +52,7 @@ export class TransactionsLockingController {
}
@Put('unlock-partial')
@ApiOperation({ summary: 'Partial unlock all transactions locking for a module or all modules' })
async unlockTransactionsLockingBetweenPeriod(
@Body('module') module: TransactionsLockingGroup,
@Body() unlockDTO: ITransactionLockingPartiallyDTO,
@@ -63,6 +69,7 @@ export class TransactionsLockingController {
}
@Put('cancel-unlock-partial')
@ApiOperation({ summary: 'Cancel partial unlocking all transactions locking for a module or all modules' })
async cancelPartialUnlocking(
@Body('module') module: TransactionsLockingGroup,
) {
@@ -77,11 +84,13 @@ export class TransactionsLockingController {
}
@Get('/')
@ApiOperation({ summary: 'Get all transactions locking meta' })
async getTransactionLockingMetaList() {
return await this.queryTransactionsLocking.getTransactionsLockingAll();
}
@Get(':module')
@ApiOperation({ summary: 'Get transactions locking meta for a module' })
async getTransactionLockingMeta(@Param('module') module: string) {
return await this.queryTransactionsLocking.getTransactionsLockingModuleMeta(
module as TransactionsLockingGroup,

View File

@@ -23,6 +23,8 @@ import { AccountsModule } from '../Accounts/Accounts.module';
import VendorCreditInventoryTransactionsSubscriber from './subscribers/VendorCreditInventoryTransactionsSusbcriber';
import { VendorCreditInventoryTransactions } from './commands/VendorCreditInventoryTransactions';
import { GetVendorCreditsService } from './queries/GetVendorCredits.service';
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
import { InventoryCostModule } from '../InventoryCost/InventoryCost.module';
@Module({
imports: [
@@ -34,7 +36,9 @@ import { GetVendorCreditsService } from './queries/GetVendorCredits.service';
BranchesModule,
WarehousesModule,
LedgerModule,
AccountsModule
AccountsModule,
DynamicListModule,
InventoryCostModule
],
providers: [
CreateVendorCreditService,

View File

@@ -1,3 +1,4 @@
// @ts-nocheck
import { Knex } from 'knex';
import { Injectable } from '@nestjs/common';
import { VendorCredit } from '../models/VendorCredit';

View File

@@ -10,7 +10,7 @@ import {
import { WarehousesApplication } from './WarehousesApplication.service';
import { ICreateWarehouseDTO, IEditWarehouseDTO } from './Warehouse.types';
import { PublicRoute } from '../Auth/Jwt.guard';
import { ApiTags } from '@nestjs/swagger';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
@Controller('warehouses')
@ApiTags('warehouses')
@@ -19,6 +19,7 @@ export class WarehousesController {
constructor(private warehousesApplication: WarehousesApplication) {}
@Post()
@ApiOperation({ summary: 'Create a warehouse' })
createWarehouse(@Body() createWarehouseDTO: ICreateWarehouseDTO) {
return this.warehousesApplication.createWarehouse(createWarehouseDTO);
}
@@ -35,31 +36,37 @@ export class WarehousesController {
}
@Delete(':id')
@ApiOperation({ summary: 'Delete a warehouse' })
deleteWarehouse(@Param('id') warehouseId: string) {
return this.warehousesApplication.deleteWarehouse(Number(warehouseId));
}
@Get(':id')
@ApiOperation({ summary: 'Get a warehouse' })
getWarehouse(@Param('id') warehouseId: string) {
return this.warehousesApplication.getWarehouse(Number(warehouseId));
}
@Get()
@ApiOperation({ summary: 'Get all warehouses' })
getWarehouses() {
return this.warehousesApplication.getWarehouses();
}
@Post('activate')
@ApiOperation({ summary: 'Activate a warehouse' })
activateWarehouses() {
return this.warehousesApplication.activateWarehouses();
}
@Post(':id/mark-primary')
@ApiOperation({ summary: 'Mark a warehouse as primary' })
markWarehousePrimary(@Param('id') warehouseId: string) {
return this.warehousesApplication.markWarehousePrimary(Number(warehouseId));
}
@Get('items/:itemId')
@ApiOperation({ summary: 'Get item warehouses' })
getItemWarehouses(@Param('itemId') itemId: string) {
return this.warehousesApplication.getItemWarehouses(Number(itemId));
}