mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
refactor
This commit is contained in:
@@ -24,6 +24,7 @@ export class AccountsController {
|
|||||||
constructor(private readonly accountsApplication: AccountsApplication) {}
|
constructor(private readonly accountsApplication: AccountsApplication) {}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
|
@ApiOperation({ summary: 'Create an account' })
|
||||||
async createAccount(@Body() accountDTO: CreateAccountDTO) {
|
async createAccount(@Body() accountDTO: CreateAccountDTO) {
|
||||||
return this.accountsApplication.createAccount(accountDTO);
|
return this.accountsApplication.createAccount(accountDTO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,17 @@ import { BankAccountsController } from './BankAccounts.controller';
|
|||||||
import { BankingPlaidModule } from '../BankingPlaid/BankingPlaid.module';
|
import { BankingPlaidModule } from '../BankingPlaid/BankingPlaid.module';
|
||||||
import { PlaidModule } from '../Plaid/Plaid.module';
|
import { PlaidModule } from '../Plaid/Plaid.module';
|
||||||
import { BankRulesModule } from '../BankRules/BankRules.module';
|
import { BankRulesModule } from '../BankRules/BankRules.module';
|
||||||
|
import { BankingTransactionsRegonizeModule } from '../BankingTranasctionsRegonize/BankingTransactionsRegonize.module';
|
||||||
|
import { BankingTransactionsModule } from '../BankingTransactions/BankingTransactions.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [BankingPlaidModule, PlaidModule, BankRulesModule],
|
imports: [
|
||||||
|
BankingPlaidModule,
|
||||||
|
PlaidModule,
|
||||||
|
BankRulesModule,
|
||||||
|
BankingTransactionsRegonizeModule,
|
||||||
|
BankingTransactionsModule,
|
||||||
|
],
|
||||||
providers: [
|
providers: [
|
||||||
DisconnectBankAccountService,
|
DisconnectBankAccountService,
|
||||||
RefreshBankAccountService,
|
RefreshBankAccountService,
|
||||||
@@ -20,7 +28,7 @@ import { BankRulesModule } from '../BankRules/BankRules.module';
|
|||||||
PauseBankAccountFeeds,
|
PauseBankAccountFeeds,
|
||||||
DeleteUncategorizedTransactionsOnAccountDeleting,
|
DeleteUncategorizedTransactionsOnAccountDeleting,
|
||||||
DisconnectPlaidItemOnAccountDeleted,
|
DisconnectPlaidItemOnAccountDeleted,
|
||||||
BankAccountsApplication
|
BankAccountsApplication,
|
||||||
],
|
],
|
||||||
exports: [BankAccountsApplication],
|
exports: [BankAccountsApplication],
|
||||||
controllers: [BankAccountsController],
|
controllers: [BankAccountsController],
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// @ts-nocheck
|
||||||
import { Injectable, Inject } from '@nestjs/common';
|
import { Injectable, Inject } from '@nestjs/common';
|
||||||
import { BankAccount } from '../models/BankAccount';
|
import { BankAccount } from '../models/BankAccount';
|
||||||
import { DynamicListService } from '@/modules/DynamicListing/DynamicList.service';
|
import { DynamicListService } from '@/modules/DynamicListing/DynamicList.service';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// @ts-nocheck
|
||||||
import { Knex } from 'knex';
|
import { Knex } from 'knex';
|
||||||
import { Bill } from '../models/Bill';
|
import { Bill } from '../models/Bill';
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import { CreditNoteGLEntries } from './commands/CreditNoteGLEntries';
|
|||||||
import { CreditNoteGLEntriesSubscriber } from './subscribers/CreditNoteGLEntriesSubscriber';
|
import { CreditNoteGLEntriesSubscriber } from './subscribers/CreditNoteGLEntriesSubscriber';
|
||||||
import { LedgerModule } from '../Ledger/Ledger.module';
|
import { LedgerModule } from '../Ledger/Ledger.module';
|
||||||
import { AccountsModule } from '../Accounts/Accounts.module';
|
import { AccountsModule } from '../Accounts/Accounts.module';
|
||||||
|
import { GetCreditNotesService } from './queries/GetCreditNotes.service';
|
||||||
|
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -33,7 +35,8 @@ import { AccountsModule } from '../Accounts/Accounts.module';
|
|||||||
TemplateInjectableModule,
|
TemplateInjectableModule,
|
||||||
AutoIncrementOrdersModule,
|
AutoIncrementOrdersModule,
|
||||||
LedgerModule,
|
LedgerModule,
|
||||||
AccountsModule
|
AccountsModule,
|
||||||
|
DynamicListModule
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
CreateCreditNoteService,
|
CreateCreditNoteService,
|
||||||
@@ -43,6 +46,7 @@ import { AccountsModule } from '../Accounts/Accounts.module';
|
|||||||
OpenCreditNoteService,
|
OpenCreditNoteService,
|
||||||
DeleteCreditNoteService,
|
DeleteCreditNoteService,
|
||||||
GetCreditNotePdf,
|
GetCreditNotePdf,
|
||||||
|
GetCreditNotesService,
|
||||||
CreditNoteAutoIncrementService,
|
CreditNoteAutoIncrementService,
|
||||||
GetCreditNoteState,
|
GetCreditNoteState,
|
||||||
CreditNoteApplication,
|
CreditNoteApplication,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// @ts-nocheck
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { InventoryTransactionsService } from '@/modules/InventoryCost/InventoryTransactions.service';
|
import { InventoryTransactionsService } from '@/modules/InventoryCost/InventoryTransactions.service';
|
||||||
import { ItemsEntriesService } from '@/modules/Items/ItemsEntries.service';
|
import { ItemsEntriesService } from '@/modules/Items/ItemsEntries.service';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// @ts-nocheck
|
||||||
import { IDynamicFilter } from './DynamicFilter.types';
|
import { IDynamicFilter } from './DynamicFilter.types';
|
||||||
import { MetableModel } from '../types/DynamicList.types';
|
import { MetableModel } from '../types/DynamicList.types';
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// @ts-nocheck
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import * as R from 'ramda';
|
import * as R from 'ramda';
|
||||||
import { IFilterRole, IDynamicFilter } from './DynamicFilter.types';
|
import { IFilterRole, IDynamicFilter } from './DynamicFilter.types';
|
||||||
|
|||||||
@@ -18,13 +18,20 @@ import { InventoryAdjustmentInventoryTransactions } from './inventory/InventoryA
|
|||||||
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
|
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
|
||||||
import { LedgerModule } from '../Ledger/Ledger.module';
|
import { LedgerModule } from '../Ledger/Ledger.module';
|
||||||
import { TenancyContext } from '../Tenancy/TenancyContext.service';
|
import { TenancyContext } from '../Tenancy/TenancyContext.service';
|
||||||
|
import { InventoryCostModule } from '../InventoryCost/InventoryCost.module';
|
||||||
|
|
||||||
const models = [
|
const models = [
|
||||||
RegisterTenancyModel(InventoryAdjustment),
|
RegisterTenancyModel(InventoryAdjustment),
|
||||||
RegisterTenancyModel(InventoryAdjustmentEntry),
|
RegisterTenancyModel(InventoryAdjustmentEntry),
|
||||||
];
|
];
|
||||||
@Module({
|
@Module({
|
||||||
imports: [BranchesModule, WarehousesModule, LedgerModule, DynamicListModule],
|
imports: [
|
||||||
|
BranchesModule,
|
||||||
|
WarehousesModule,
|
||||||
|
LedgerModule,
|
||||||
|
DynamicListModule,
|
||||||
|
InventoryCostModule,
|
||||||
|
],
|
||||||
controllers: [InventoryAdjustmentsController],
|
controllers: [InventoryAdjustmentsController],
|
||||||
providers: [
|
providers: [
|
||||||
...models,
|
...models,
|
||||||
@@ -38,7 +45,7 @@ const models = [
|
|||||||
InventoryAdjustmentsGLEntries,
|
InventoryAdjustmentsGLEntries,
|
||||||
TenancyContext,
|
TenancyContext,
|
||||||
InventoryAdjustmentInventoryTransactionsSubscriber,
|
InventoryAdjustmentInventoryTransactionsSubscriber,
|
||||||
InventoryAdjustmentInventoryTransactions
|
InventoryAdjustmentInventoryTransactions,
|
||||||
],
|
],
|
||||||
exports: [...models],
|
exports: [...models],
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ const models = [
|
|||||||
InventoryCostGLStorage,
|
InventoryCostGLStorage,
|
||||||
InventoryItemsQuantitySyncService,
|
InventoryItemsQuantitySyncService,
|
||||||
InventoryCostMethod,
|
InventoryCostMethod,
|
||||||
InventoryTransactionsService
|
InventoryTransactionsService,
|
||||||
],
|
],
|
||||||
exports: [...models],
|
exports: [...models, InventoryTransactionsService],
|
||||||
})
|
})
|
||||||
export class InventoryCostModule {}
|
export class InventoryCostModule {}
|
||||||
|
|||||||
@@ -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 { EventEmitter2 } from '@nestjs/event-emitter';
|
||||||
|
import {
|
||||||
|
IInventoryTransactionsDeletedPayload,
|
||||||
|
TInventoryTransactionDirection,
|
||||||
|
} from './types/InventoryCost.types';
|
||||||
import { InventoryCostLotTracker } from './models/InventoryCostLotTracker';
|
import { InventoryCostLotTracker } from './models/InventoryCostLotTracker';
|
||||||
import { InventoryTransaction } from './models/InventoryTransaction';
|
import { InventoryTransaction } from './models/InventoryTransaction';
|
||||||
import { Knex } from 'knex';
|
|
||||||
import { events } from '@/common/events/events';
|
import { events } from '@/common/events/events';
|
||||||
import { IInventoryTransactionsCreatedPayload } from './types/InventoryCost.types';
|
import { IInventoryTransactionsCreatedPayload } from './types/InventoryCost.types';
|
||||||
import { transformItemEntriesToInventory } from "./utils";
|
import { transformItemEntriesToInventory } from './utils';
|
||||||
import { IItemEntryTransactionType } from '../TransactionItemEntry/ItemEntry.types';
|
import { IItemEntryTransactionType } from '../TransactionItemEntry/ItemEntry.types';
|
||||||
import { ItemEntry } from '../TransactionItemEntry/models/ItemEntry';
|
import { ItemEntry } from '../TransactionItemEntry/models/ItemEntry';
|
||||||
import { Inject } from '@nestjs/common';
|
|
||||||
|
|
||||||
export class InventoryTransactionsService {
|
export class InventoryTransactionsService {
|
||||||
constructor(
|
constructor(
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// @ts-nocheck
|
||||||
import { chain } from 'lodash';
|
import { chain } from 'lodash';
|
||||||
import { pick } from 'lodash';
|
import { pick } from 'lodash';
|
||||||
import { IItemEntryTransactionType } from '../TransactionItemEntry/ItemEntry.types';
|
import { IItemEntryTransactionType } from '../TransactionItemEntry/ItemEntry.types';
|
||||||
|
|||||||
@@ -27,9 +27,13 @@ import { PaymentReceivedInvoiceSync } from './commands/PaymentReceivedInvoiceSyn
|
|||||||
import { LedgerModule } from '../Ledger/Ledger.module';
|
import { LedgerModule } from '../Ledger/Ledger.module';
|
||||||
import { AccountsModule } from '../Accounts/Accounts.module';
|
import { AccountsModule } from '../Accounts/Accounts.module';
|
||||||
import { SendPaymentReceiveMailNotification } from './commands/PaymentReceivedMailNotification';
|
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({
|
@Module({
|
||||||
controllers: [PaymentReceivesController],
|
controllers: [PaymentReceivesController,],
|
||||||
providers: [
|
providers: [
|
||||||
PaymentReceivesApplication,
|
PaymentReceivesApplication,
|
||||||
CreatePaymentReceivedService,
|
CreatePaymentReceivedService,
|
||||||
@@ -49,7 +53,8 @@ import { SendPaymentReceiveMailNotification } from './commands/PaymentReceivedMa
|
|||||||
PaymentReceivedAutoIncrementSubscriber,
|
PaymentReceivedAutoIncrementSubscriber,
|
||||||
PaymentReceivedGLEntriesSubscriber,
|
PaymentReceivedGLEntriesSubscriber,
|
||||||
PaymentReceivedSyncInvoicesSubscriber,
|
PaymentReceivedSyncInvoicesSubscriber,
|
||||||
SendPaymentReceiveMailNotification
|
SendPaymentReceiveMailNotification,
|
||||||
|
GetPaymentsReceivedService
|
||||||
],
|
],
|
||||||
exports: [PaymentReceivesApplication, CreatePaymentReceivedService],
|
exports: [PaymentReceivesApplication, CreatePaymentReceivedService],
|
||||||
imports: [
|
imports: [
|
||||||
@@ -60,7 +65,10 @@ import { SendPaymentReceiveMailNotification } from './commands/PaymentReceivedMa
|
|||||||
PdfTemplatesModule,
|
PdfTemplatesModule,
|
||||||
AutoIncrementOrdersModule,
|
AutoIncrementOrdersModule,
|
||||||
LedgerModule,
|
LedgerModule,
|
||||||
AccountsModule
|
AccountsModule,
|
||||||
|
MailNotificationModule,
|
||||||
|
DynamicListModule,
|
||||||
|
MailModule
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class PaymentsReceivedModule {}
|
export class PaymentsReceivedModule {}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export class GetPaymentsReceivedService {
|
|||||||
builder.withGraphFetched('depositAccount');
|
builder.withGraphFetched('depositAccount');
|
||||||
|
|
||||||
dynamicList.buildQuery()(builder);
|
dynamicList.buildQuery()(builder);
|
||||||
filterDTO?.filterQuery && filterDTO.filterQuery(builder);
|
filterDTO?.filterQuery && filterDTO.filterQuery(builder as any);
|
||||||
})
|
})
|
||||||
.pagination(filter.page - 1, filter.pageSize);
|
.pagination(filter.page - 1, filter.pageSize);
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ import { MailNotificationModule } from '../MailNotification/MailNotification.mod
|
|||||||
import { MailModule } from '../Mail/Mail.module';
|
import { MailModule } from '../Mail/Mail.module';
|
||||||
import { ChromiumlyTenancyModule } from '../ChromiumlyTenancy/ChromiumlyTenancy.module';
|
import { ChromiumlyTenancyModule } from '../ChromiumlyTenancy/ChromiumlyTenancy.module';
|
||||||
import { TemplateInjectableModule } from '../TemplateInjectable/TemplateInjectable.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';
|
// import { SaleEstimateNotifyBySms } from './commands/SaleEstimateSmsNotify';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
@@ -40,7 +42,8 @@ import { TemplateInjectableModule } from '../TemplateInjectable/TemplateInjectab
|
|||||||
MailNotificationModule,
|
MailNotificationModule,
|
||||||
MailModule,
|
MailModule,
|
||||||
ChromiumlyTenancyModule,
|
ChromiumlyTenancyModule,
|
||||||
TemplateInjectableModule
|
TemplateInjectableModule,
|
||||||
|
PdfTemplatesModule
|
||||||
],
|
],
|
||||||
controllers: [SaleEstimatesController],
|
controllers: [SaleEstimatesController],
|
||||||
providers: [
|
providers: [
|
||||||
@@ -69,6 +72,7 @@ import { TemplateInjectableModule } from '../TemplateInjectable/TemplateInjectab
|
|||||||
SaleEstimatesApplication,
|
SaleEstimatesApplication,
|
||||||
SendSaleEstimateMail,
|
SendSaleEstimateMail,
|
||||||
GetSaleEstimatePdf,
|
GetSaleEstimatePdf,
|
||||||
|
SaleEstimatePdfTemplate
|
||||||
// SaleEstimateNotifyBySms,
|
// SaleEstimateNotifyBySms,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -33,11 +33,17 @@ import { InvoiceGLEntriesSubscriber } from './subscribers/InvoiceGLEntriesSubscr
|
|||||||
import { SaleInvoiceGLEntries } from './ledger/InvoiceGLEntries';
|
import { SaleInvoiceGLEntries } from './ledger/InvoiceGLEntries';
|
||||||
import { LedgerModule } from '../Ledger/Ledger.module';
|
import { LedgerModule } from '../Ledger/Ledger.module';
|
||||||
import { AccountsModule } from '../Accounts/Accounts.module';
|
import { AccountsModule } from '../Accounts/Accounts.module';
|
||||||
import SaleInvoiceWriteoffSubscriber from './subscribers/SaleInvoiceWriteoffSubscriber';
|
import { SaleInvoiceWriteoffSubscriber } from './subscribers/SaleInvoiceWriteoffSubscriber';
|
||||||
import { SaleInvoiceWriteoffGLStorage } from './commands/writeoff/SaleInvoiceWriteoffGLStorage';
|
import { SaleInvoiceWriteoffGLStorage } from './commands/writeoff/SaleInvoiceWriteoffGLStorage';
|
||||||
import { InvoiceInventoryTransactions } from './commands/inventory/InvoiceInventoryTransactions';
|
import { InvoiceInventoryTransactions } from './commands/inventory/InvoiceInventoryTransactions';
|
||||||
import { SendSaleEstimateMail } from '../SaleEstimates/commands/SendSaleEstimateMail';
|
|
||||||
import { MailModule } from '../Mail/Mail.module';
|
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({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -51,6 +57,9 @@ import { MailModule } from '../Mail/Mail.module';
|
|||||||
LedgerModule,
|
LedgerModule,
|
||||||
AccountsModule,
|
AccountsModule,
|
||||||
MailModule,
|
MailModule,
|
||||||
|
MailNotificationModule,
|
||||||
|
InventoryCostModule,
|
||||||
|
DynamicListModule
|
||||||
],
|
],
|
||||||
controllers: [SaleInvoicesController],
|
controllers: [SaleInvoicesController],
|
||||||
providers: [
|
providers: [
|
||||||
@@ -82,7 +91,10 @@ import { MailModule } from '../Mail/Mail.module';
|
|||||||
SaleInvoiceWriteoffGLStorage,
|
SaleInvoiceWriteoffGLStorage,
|
||||||
SaleInvoiceWriteoffSubscriber,
|
SaleInvoiceWriteoffSubscriber,
|
||||||
InvoiceInventoryTransactions,
|
InvoiceInventoryTransactions,
|
||||||
SendSaleEstimateMail,
|
SendSaleInvoiceMail,
|
||||||
|
GetSaleInvoicesService,
|
||||||
|
GetSaleInvoiceMailState,
|
||||||
|
SendSaleInvoiceMailCommon
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class SaleInvoicesModule {}
|
export class SaleInvoicesModule {}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// @ts-nocheck
|
||||||
import { InventoryTransactionsService } from '@/modules/InventoryCost/InventoryTransactions.service';
|
import { InventoryTransactionsService } from '@/modules/InventoryCost/InventoryTransactions.service';
|
||||||
import { ItemsEntriesService } from '@/modules/Items/ItemsEntries.service';
|
import { ItemsEntriesService } from '@/modules/Items/ItemsEntries.service';
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { SaleInvoiceWriteoffGLStorage } from '../commands/writeoff/SaleInvoiceWr
|
|||||||
import { events } from '@/common/events/events';
|
import { events } from '@/common/events/events';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export default class SaleInvoiceWriteoffSubscriber {
|
export class SaleInvoiceWriteoffSubscriber {
|
||||||
constructor(private readonly writeGLStorage: SaleInvoiceWriteoffGLStorage) {}
|
constructor(private readonly writeGLStorage: SaleInvoiceWriteoffGLStorage) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -27,6 +27,11 @@ import { AccountsModule } from '../Accounts/Accounts.module';
|
|||||||
import { SaleReceiptInventoryTransactionsSubscriber } from './inventory/SaleReceiptWriteInventoryTransactions';
|
import { SaleReceiptInventoryTransactionsSubscriber } from './inventory/SaleReceiptWriteInventoryTransactions';
|
||||||
import { GetSaleReceiptsService } from './queries/GetSaleReceipts.service';
|
import { GetSaleReceiptsService } from './queries/GetSaleReceipts.service';
|
||||||
import { SaleReceiptMailNotification } from './commands/SaleReceiptMailNotification';
|
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({
|
@Module({
|
||||||
controllers: [SaleReceiptsController],
|
controllers: [SaleReceiptsController],
|
||||||
@@ -39,7 +44,11 @@ import { SaleReceiptMailNotification } from './commands/SaleReceiptMailNotificat
|
|||||||
PdfTemplatesModule,
|
PdfTemplatesModule,
|
||||||
AutoIncrementOrdersModule,
|
AutoIncrementOrdersModule,
|
||||||
LedgerModule,
|
LedgerModule,
|
||||||
AccountsModule
|
AccountsModule,
|
||||||
|
InventoryCostModule,
|
||||||
|
DynamicListModule,
|
||||||
|
MailModule,
|
||||||
|
MailNotificationModule
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
TenancyContext,
|
TenancyContext,
|
||||||
@@ -57,9 +66,10 @@ import { SaleReceiptMailNotification } from './commands/SaleReceiptMailNotificat
|
|||||||
SaleReceiptIncrement,
|
SaleReceiptIncrement,
|
||||||
SaleReceiptGLEntries,
|
SaleReceiptGLEntries,
|
||||||
SaleReceiptGLEntriesSubscriber,
|
SaleReceiptGLEntriesSubscriber,
|
||||||
SaleReceiptInventoryTransactionsSubscriber,
|
|
||||||
GetSaleReceiptsService,
|
GetSaleReceiptsService,
|
||||||
SaleReceiptMailNotification
|
SaleReceiptMailNotification,
|
||||||
|
SaleReceiptInventoryTransactions,
|
||||||
|
SaleReceiptInventoryTransactionsSubscriber,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class SaleReceiptsModule {}
|
export class SaleReceiptsModule {}
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
|
// @ts-nocheck
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { Knex } from 'knex';
|
import { Knex } from 'knex';
|
||||||
import { InventoryService } from '@/modules/InventoryCost/Inventory';
|
|
||||||
import { ItemsEntriesService } from '@/modules/Items/ItemsEntries.service';
|
|
||||||
import { SaleReceipt } from '../models/SaleReceipt';
|
import { SaleReceipt } from '../models/SaleReceipt';
|
||||||
|
import { InventoryTransactionsService } from '@/modules/InventoryCost/InventoryTransactions.service';
|
||||||
|
import { ItemsEntriesService } from '@/modules/Items/ItemsEntries.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SaleReceiptInventoryTransactions {
|
export class SaleReceiptInventoryTransactions {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly itemsEntriesService: ItemsEntriesService,
|
private readonly itemsEntriesService: ItemsEntriesService,
|
||||||
private readonly inventoryService: InventoryService,
|
private readonly inventoryService: InventoryTransactionsService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,8 +6,11 @@ import { ICancelTransactionsLockingDTO } from './types/TransactionsLocking.types
|
|||||||
import { ITransactionLockingPartiallyDTO } from './types/TransactionsLocking.types';
|
import { ITransactionLockingPartiallyDTO } from './types/TransactionsLocking.types';
|
||||||
import { QueryTransactionsLocking } from './queries/QueryTransactionsLocking';
|
import { QueryTransactionsLocking } from './queries/QueryTransactionsLocking';
|
||||||
import { PublicRoute } from '../Auth/Jwt.guard';
|
import { PublicRoute } from '../Auth/Jwt.guard';
|
||||||
|
import { ApiOperation } from '@nestjs/swagger';
|
||||||
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('transactions-locking')
|
@Controller('transactions-locking')
|
||||||
|
@ApiTags('Transactions Locking')
|
||||||
@PublicRoute()
|
@PublicRoute()
|
||||||
export class TransactionsLockingController {
|
export class TransactionsLockingController {
|
||||||
constructor(
|
constructor(
|
||||||
@@ -16,6 +19,7 @@ export class TransactionsLockingController {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
@Put('lock')
|
@Put('lock')
|
||||||
|
@ApiOperation({ summary: 'Lock all transactions for a module or all modules' })
|
||||||
async commandTransactionsLocking(
|
async commandTransactionsLocking(
|
||||||
@Body('module') module: TransactionsLockingGroup,
|
@Body('module') module: TransactionsLockingGroup,
|
||||||
@Body() transactionLockingDTO: ITransactionsLockingAllDTO,
|
@Body() transactionLockingDTO: ITransactionsLockingAllDTO,
|
||||||
@@ -32,6 +36,7 @@ export class TransactionsLockingController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Put('cancel-lock')
|
@Put('cancel-lock')
|
||||||
|
@ApiOperation({ summary: 'Cancel all transactions locking for a module or all modules' })
|
||||||
async cancelTransactionLocking(
|
async cancelTransactionLocking(
|
||||||
@Body('module') module: TransactionsLockingGroup,
|
@Body('module') module: TransactionsLockingGroup,
|
||||||
@Body() cancelLockingDTO: ICancelTransactionsLockingDTO,
|
@Body() cancelLockingDTO: ICancelTransactionsLockingDTO,
|
||||||
@@ -47,6 +52,7 @@ export class TransactionsLockingController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Put('unlock-partial')
|
@Put('unlock-partial')
|
||||||
|
@ApiOperation({ summary: 'Partial unlock all transactions locking for a module or all modules' })
|
||||||
async unlockTransactionsLockingBetweenPeriod(
|
async unlockTransactionsLockingBetweenPeriod(
|
||||||
@Body('module') module: TransactionsLockingGroup,
|
@Body('module') module: TransactionsLockingGroup,
|
||||||
@Body() unlockDTO: ITransactionLockingPartiallyDTO,
|
@Body() unlockDTO: ITransactionLockingPartiallyDTO,
|
||||||
@@ -63,6 +69,7 @@ export class TransactionsLockingController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Put('cancel-unlock-partial')
|
@Put('cancel-unlock-partial')
|
||||||
|
@ApiOperation({ summary: 'Cancel partial unlocking all transactions locking for a module or all modules' })
|
||||||
async cancelPartialUnlocking(
|
async cancelPartialUnlocking(
|
||||||
@Body('module') module: TransactionsLockingGroup,
|
@Body('module') module: TransactionsLockingGroup,
|
||||||
) {
|
) {
|
||||||
@@ -77,11 +84,13 @@ export class TransactionsLockingController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get('/')
|
@Get('/')
|
||||||
|
@ApiOperation({ summary: 'Get all transactions locking meta' })
|
||||||
async getTransactionLockingMetaList() {
|
async getTransactionLockingMetaList() {
|
||||||
return await this.queryTransactionsLocking.getTransactionsLockingAll();
|
return await this.queryTransactionsLocking.getTransactionsLockingAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':module')
|
@Get(':module')
|
||||||
|
@ApiOperation({ summary: 'Get transactions locking meta for a module' })
|
||||||
async getTransactionLockingMeta(@Param('module') module: string) {
|
async getTransactionLockingMeta(@Param('module') module: string) {
|
||||||
return await this.queryTransactionsLocking.getTransactionsLockingModuleMeta(
|
return await this.queryTransactionsLocking.getTransactionsLockingModuleMeta(
|
||||||
module as TransactionsLockingGroup,
|
module as TransactionsLockingGroup,
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ import { AccountsModule } from '../Accounts/Accounts.module';
|
|||||||
import VendorCreditInventoryTransactionsSubscriber from './subscribers/VendorCreditInventoryTransactionsSusbcriber';
|
import VendorCreditInventoryTransactionsSubscriber from './subscribers/VendorCreditInventoryTransactionsSusbcriber';
|
||||||
import { VendorCreditInventoryTransactions } from './commands/VendorCreditInventoryTransactions';
|
import { VendorCreditInventoryTransactions } from './commands/VendorCreditInventoryTransactions';
|
||||||
import { GetVendorCreditsService } from './queries/GetVendorCredits.service';
|
import { GetVendorCreditsService } from './queries/GetVendorCredits.service';
|
||||||
|
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
|
||||||
|
import { InventoryCostModule } from '../InventoryCost/InventoryCost.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -34,7 +36,9 @@ import { GetVendorCreditsService } from './queries/GetVendorCredits.service';
|
|||||||
BranchesModule,
|
BranchesModule,
|
||||||
WarehousesModule,
|
WarehousesModule,
|
||||||
LedgerModule,
|
LedgerModule,
|
||||||
AccountsModule
|
AccountsModule,
|
||||||
|
DynamicListModule,
|
||||||
|
InventoryCostModule
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
CreateVendorCreditService,
|
CreateVendorCreditService,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// @ts-nocheck
|
||||||
import { Knex } from 'knex';
|
import { Knex } from 'knex';
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { VendorCredit } from '../models/VendorCredit';
|
import { VendorCredit } from '../models/VendorCredit';
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
import { WarehousesApplication } from './WarehousesApplication.service';
|
import { WarehousesApplication } from './WarehousesApplication.service';
|
||||||
import { ICreateWarehouseDTO, IEditWarehouseDTO } from './Warehouse.types';
|
import { ICreateWarehouseDTO, IEditWarehouseDTO } from './Warehouse.types';
|
||||||
import { PublicRoute } from '../Auth/Jwt.guard';
|
import { PublicRoute } from '../Auth/Jwt.guard';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('warehouses')
|
@Controller('warehouses')
|
||||||
@ApiTags('warehouses')
|
@ApiTags('warehouses')
|
||||||
@@ -19,6 +19,7 @@ export class WarehousesController {
|
|||||||
constructor(private warehousesApplication: WarehousesApplication) {}
|
constructor(private warehousesApplication: WarehousesApplication) {}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
|
@ApiOperation({ summary: 'Create a warehouse' })
|
||||||
createWarehouse(@Body() createWarehouseDTO: ICreateWarehouseDTO) {
|
createWarehouse(@Body() createWarehouseDTO: ICreateWarehouseDTO) {
|
||||||
return this.warehousesApplication.createWarehouse(createWarehouseDTO);
|
return this.warehousesApplication.createWarehouse(createWarehouseDTO);
|
||||||
}
|
}
|
||||||
@@ -35,31 +36,37 @@ export class WarehousesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
|
@ApiOperation({ summary: 'Delete a warehouse' })
|
||||||
deleteWarehouse(@Param('id') warehouseId: string) {
|
deleteWarehouse(@Param('id') warehouseId: string) {
|
||||||
return this.warehousesApplication.deleteWarehouse(Number(warehouseId));
|
return this.warehousesApplication.deleteWarehouse(Number(warehouseId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
|
@ApiOperation({ summary: 'Get a warehouse' })
|
||||||
getWarehouse(@Param('id') warehouseId: string) {
|
getWarehouse(@Param('id') warehouseId: string) {
|
||||||
return this.warehousesApplication.getWarehouse(Number(warehouseId));
|
return this.warehousesApplication.getWarehouse(Number(warehouseId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
|
@ApiOperation({ summary: 'Get all warehouses' })
|
||||||
getWarehouses() {
|
getWarehouses() {
|
||||||
return this.warehousesApplication.getWarehouses();
|
return this.warehousesApplication.getWarehouses();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post('activate')
|
@Post('activate')
|
||||||
|
@ApiOperation({ summary: 'Activate a warehouse' })
|
||||||
activateWarehouses() {
|
activateWarehouses() {
|
||||||
return this.warehousesApplication.activateWarehouses();
|
return this.warehousesApplication.activateWarehouses();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post(':id/mark-primary')
|
@Post(':id/mark-primary')
|
||||||
|
@ApiOperation({ summary: 'Mark a warehouse as primary' })
|
||||||
markWarehousePrimary(@Param('id') warehouseId: string) {
|
markWarehousePrimary(@Param('id') warehouseId: string) {
|
||||||
return this.warehousesApplication.markWarehousePrimary(Number(warehouseId));
|
return this.warehousesApplication.markWarehousePrimary(Number(warehouseId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('items/:itemId')
|
@Get('items/:itemId')
|
||||||
|
@ApiOperation({ summary: 'Get item warehouses' })
|
||||||
getItemWarehouses(@Param('itemId') itemId: string) {
|
getItemWarehouses(@Param('itemId') itemId: string) {
|
||||||
return this.warehousesApplication.getItemWarehouses(Number(itemId));
|
return this.warehousesApplication.getItemWarehouses(Number(itemId));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user