feat: add header swagger docs

This commit is contained in:
Ahmed Bouhuolia
2025-07-02 17:42:17 +02:00
parent b2d61160dd
commit 456a9e1ad9
65 changed files with 172 additions and 48 deletions

View File

@@ -0,0 +1,20 @@
import { applyDecorators } from '@nestjs/common';
import { ApiHeader } from '@nestjs/swagger';
export function ApiCommonHeaders() {
return applyDecorators(
ApiHeader({
name: 'Authorization',
description:
"Value must be 'Bearer <token>' where <token> is an API key prefixed with 'bc_' or a JWT token.",
schema: { type: 'string', example: 'Bearer bc_1234567890abcdef' },
required: true,
}),
ApiHeader({
name: 'organization-id',
description:
'Required if Authorization is a JWT token. The organization ID to operate within.',
required: true,
}),
);
}

View File

@@ -30,7 +30,6 @@ async function bootstrap() {
.setTitle('Bigcapital') .setTitle('Bigcapital')
.setDescription('Financial accounting software') .setDescription('Financial accounting software')
.setVersion('1.0') .setVersion('1.0')
.addTag('cats')
.build(); .build();
const documentFactory = () => SwaggerModule.createDocument(app, config); const documentFactory = () => SwaggerModule.createDocument(app, config);

View File

@@ -24,12 +24,14 @@ import { AccountResponseDto } from './dtos/AccountResponse.dto';
import { AccountTypeResponseDto } from './dtos/AccountTypeResponse.dto'; import { AccountTypeResponseDto } from './dtos/AccountTypeResponse.dto';
import { GetAccountTransactionResponseDto } from './dtos/GetAccountTransactionResponse.dto'; import { GetAccountTransactionResponseDto } from './dtos/GetAccountTransactionResponse.dto';
import { GetAccountTransactionsQueryDto } from './dtos/GetAccountTransactionsQuery.dto'; import { GetAccountTransactionsQueryDto } from './dtos/GetAccountTransactionsQuery.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('accounts') @Controller('accounts')
@ApiTags('Accounts') @ApiTags('Accounts')
@ApiExtraModels(AccountResponseDto) @ApiExtraModels(AccountResponseDto)
@ApiExtraModels(AccountTypeResponseDto) @ApiExtraModels(AccountTypeResponseDto)
@ApiExtraModels(GetAccountTransactionResponseDto) @ApiExtraModels(GetAccountTransactionResponseDto)
@ApiCommonHeaders()
export class AccountsController { export class AccountsController {
constructor(private readonly accountsApplication: AccountsApplication) {} constructor(private readonly accountsApplication: AccountsApplication) {}

View File

@@ -2,11 +2,4 @@ import { Controller, Get } from '@nestjs/common';
import { AppService } from './App.service'; import { AppService } from './App.service';
@Controller() @Controller()
export class AppController { export class AppController {}
constructor(private readonly appService: AppService) {}
@Get()
getHello(): string {
return this.appService.getHello();
}
}

View File

@@ -30,9 +30,11 @@ import { AttachmentsApplication } from './AttachmentsApplication';
import { AttachmentUploadPipeline } from './S3UploadPipeline'; import { AttachmentUploadPipeline } from './S3UploadPipeline';
import { FileInterceptor } from '@/common/interceptors/file.interceptor'; import { FileInterceptor } from '@/common/interceptors/file.interceptor';
import { ConfigService } from '@nestjs/config'; import { ConfigService } from '@nestjs/config';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@ApiTags('Attachments') @ApiTags('Attachments')
@Controller('/attachments') @Controller('/attachments')
@ApiCommonHeaders()
export class AttachmentsController { export class AttachmentsController {
/** /**
* @param {AttachmentsApplication} attachmentsApplication - Attachments application. * @param {AttachmentsApplication} attachmentsApplication - Attachments application.
@@ -109,9 +111,7 @@ export class AttachmentsController {
status: 200, status: 200,
description: 'The document has been deleted successfully', description: 'The document has been deleted successfully',
}) })
async deleteAttachment( async deleteAttachment(@Param('id') documentId: string) {
@Param('id') documentId: string,
) {
await this.attachmentsApplication.delete(documentId); await this.attachmentsApplication.delete(documentId);
return { return {

View File

@@ -8,7 +8,13 @@ import {
Request, Request,
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiBody, ApiParam } from '@nestjs/swagger'; import {
ApiTags,
ApiOperation,
ApiBody,
ApiParam,
ApiExcludeController,
} from '@nestjs/swagger';
import { PublicRoute } from './guards/jwt.guard'; import { PublicRoute } from './guards/jwt.guard';
import { AuthenticationApplication } from './AuthApplication.sevice'; import { AuthenticationApplication } from './AuthApplication.sevice';
import { AuthSignupDto } from './dtos/AuthSignup.dto'; import { AuthSignupDto } from './dtos/AuthSignup.dto';
@@ -20,6 +26,7 @@ import { SystemUser } from '../System/models/SystemUser';
@Controller('/auth') @Controller('/auth')
@ApiTags('Auth') @ApiTags('Auth')
@ApiExcludeController()
@PublicRoute() @PublicRoute()
export class AuthController { export class AuthController {
constructor( constructor(

View File

@@ -1,8 +1,12 @@
import { Controller, Post, Param, Get, Put } from '@nestjs/common'; import { Controller, Post, Param, Get, Put } from '@nestjs/common';
import { GenerateApiKey } from './commands/GenerateApiKey.service'; import { GenerateApiKey } from './commands/GenerateApiKey.service';
import { GetApiKeysService } from './queries/GetApiKeys.service'; import { GetApiKeysService } from './queries/GetApiKeys.service';
import { ApiExcludeController, ApiTags } from '@nestjs/swagger';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('api-keys') @Controller('api-keys')
@ApiTags('Api keys')
@ApiCommonHeaders()
export class AuthApiKeysController { export class AuthApiKeysController {
constructor( constructor(
private readonly getApiKeysService: GetApiKeysService, private readonly getApiKeysService: GetApiKeysService,

View File

@@ -1,4 +1,9 @@
import { ApiBody, ApiOperation, ApiTags } from '@nestjs/swagger'; import {
ApiBody,
ApiExcludeController,
ApiOperation,
ApiTags,
} from '@nestjs/swagger';
import { GetAuthenticatedAccount } from './queries/GetAuthedAccount.service'; import { GetAuthenticatedAccount } from './queries/GetAuthedAccount.service';
import { Controller, Get, Post } from '@nestjs/common'; import { Controller, Get, Post } from '@nestjs/common';
import { IgnoreTenantSeededRoute } from '../Tenancy/EnsureTenantIsSeeded.guards'; import { IgnoreTenantSeededRoute } from '../Tenancy/EnsureTenantIsSeeded.guards';
@@ -9,6 +14,7 @@ import { IgnoreUserVerifiedRoute } from './guards/EnsureUserVerified.guard';
@Controller('/auth') @Controller('/auth')
@ApiTags('Auth') @ApiTags('Auth')
@ApiExcludeController()
@IgnoreTenantSeededRoute() @IgnoreTenantSeededRoute()
@IgnoreTenantInitializedRoute() @IgnoreTenantInitializedRoute()
@IgnoreUserVerifiedRoute() @IgnoreUserVerifiedRoute()

View File

@@ -18,10 +18,12 @@ import { BankRulesApplication } from './BankRulesApplication';
import { CreateBankRuleDto } from './dtos/BankRule.dto'; import { CreateBankRuleDto } from './dtos/BankRule.dto';
import { EditBankRuleDto } from './dtos/BankRule.dto'; import { EditBankRuleDto } from './dtos/BankRule.dto';
import { BankRuleResponseDto } from './dtos/BankRuleResponse.dto'; import { BankRuleResponseDto } from './dtos/BankRuleResponse.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('banking/rules') @Controller('banking/rules')
@ApiTags('Bank Rules') @ApiTags('Bank Rules')
@ApiExtraModels(BankRuleResponseDto) @ApiExtraModels(BankRuleResponseDto)
@ApiCommonHeaders()
export class BankRulesController { export class BankRulesController {
constructor(private readonly bankRulesApplication: BankRulesApplication) {} constructor(private readonly bankRulesApplication: BankRulesApplication) {}

View File

@@ -3,9 +3,11 @@ import { castArray, omit } from 'lodash';
import { BankingCategorizeApplication } from './BankingCategorize.application'; import { BankingCategorizeApplication } from './BankingCategorize.application';
import { CategorizeBankTransactionRouteDto } from './dtos/CategorizeBankTransaction.dto'; import { CategorizeBankTransactionRouteDto } from './dtos/CategorizeBankTransaction.dto';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger'; import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('banking/categorize') @Controller('banking/categorize')
@ApiTags('Banking Categorization') @ApiTags('Banking Categorization')
@ApiCommonHeaders()
export class BankingCategorizeController { export class BankingCategorizeController {
constructor( constructor(
private readonly bankingCategorizeApplication: BankingCategorizeApplication, private readonly bankingCategorizeApplication: BankingCategorizeApplication,

View File

@@ -3,9 +3,11 @@ import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
import { BankingMatchingApplication } from './BankingMatchingApplication'; import { BankingMatchingApplication } from './BankingMatchingApplication';
import { GetMatchedTransactionsFilter } from './types'; import { GetMatchedTransactionsFilter } from './types';
import { MatchBankTransactionDto } from './dtos/MatchBankTransaction.dto'; import { MatchBankTransactionDto } from './dtos/MatchBankTransaction.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('banking/matching') @Controller('banking/matching')
@ApiTags('Banking Transactions Matching') @ApiTags('Banking Transactions Matching')
@ApiCommonHeaders()
export class BankingMatchingController { export class BankingMatchingController {
constructor( constructor(
private readonly bankingMatchingApplication: BankingMatchingApplication, private readonly bankingMatchingApplication: BankingMatchingApplication,

View File

@@ -10,10 +10,12 @@ import {
} from '@nestjs/swagger'; } from '@nestjs/swagger';
import { RecognizedTransactionsApplication } from './RecognizedTransactions.application'; import { RecognizedTransactionsApplication } from './RecognizedTransactions.application';
import { GetRecognizedTransactionResponseDto } from './dtos/GetRecognizedTransactionResponse.dto'; import { GetRecognizedTransactionResponseDto } from './dtos/GetRecognizedTransactionResponse.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('banking/recognized') @Controller('banking/recognized')
@ApiTags('Banking Recognized Transactions') @ApiTags('Banking Recognized Transactions')
@ApiExtraModels(GetRecognizedTransactionResponseDto) @ApiExtraModels(GetRecognizedTransactionResponseDto)
@ApiCommonHeaders()
export class BankingRecognizedTransactionsController { export class BankingRecognizedTransactionsController {
constructor( constructor(
private readonly recognizedTransactionsApplication: RecognizedTransactionsApplication, private readonly recognizedTransactionsApplication: RecognizedTransactionsApplication,

View File

@@ -10,10 +10,12 @@ import {
import { BankingTransactionsApplication } from '../BankingTransactionsApplication.service'; import { BankingTransactionsApplication } from '../BankingTransactionsApplication.service';
import { GetPendingTransactionsQueryDto } from '../dtos/GetPendingTransactionsQuery.dto'; import { GetPendingTransactionsQueryDto } from '../dtos/GetPendingTransactionsQuery.dto';
import { GetPendingTransactionResponseDto } from '../dtos/GetPendingTransactionResponse.dto'; import { GetPendingTransactionResponseDto } from '../dtos/GetPendingTransactionResponse.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('banking/pending') @Controller('banking/pending')
@ApiTags('Banking Pending Transactions') @ApiTags('Banking Pending Transactions')
@ApiExtraModels(GetPendingTransactionResponseDto) @ApiExtraModels(GetPendingTransactionResponseDto)
@ApiCommonHeaders()
export class BankingPendingTransactionsController { export class BankingPendingTransactionsController {
constructor( constructor(
private readonly bankingTransactionsApplication: BankingTransactionsApplication, private readonly bankingTransactionsApplication: BankingTransactionsApplication,

View File

@@ -22,10 +22,12 @@ import { CreateBankTransactionDto } from '../dtos/CreateBankTransaction.dto';
import { GetBankTransactionsQueryDto } from '../dtos/GetBankTranasctionsQuery.dto'; import { GetBankTransactionsQueryDto } from '../dtos/GetBankTranasctionsQuery.dto';
import { BankTransactionResponseDto } from '../dtos/BankTransactionResponse.dto'; import { BankTransactionResponseDto } from '../dtos/BankTransactionResponse.dto';
import { PaginatedResponseDto } from '@/common/dtos/PaginatedResults.dto'; import { PaginatedResponseDto } from '@/common/dtos/PaginatedResults.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('banking/transactions') @Controller('banking/transactions')
@ApiTags('Banking Transactions') @ApiTags('Banking Transactions')
@ApiExtraModels(BankTransactionResponseDto, PaginatedResponseDto) @ApiExtraModels(BankTransactionResponseDto, PaginatedResponseDto)
@ApiCommonHeaders()
export class BankingTransactionsController { export class BankingTransactionsController {
constructor( constructor(
private readonly bankingTransactionsApplication: BankingTransactionsApplication, private readonly bankingTransactionsApplication: BankingTransactionsApplication,

View File

@@ -8,9 +8,11 @@ import {
} from '@nestjs/swagger'; } from '@nestjs/swagger';
import { GetUncategorizedTransactionsQueryDto } from '../dtos/GetUncategorizedTransactionsQuery.dto'; import { GetUncategorizedTransactionsQueryDto } from '../dtos/GetUncategorizedTransactionsQuery.dto';
import { BankingTransactionsApplication } from '../BankingTransactionsApplication.service'; import { BankingTransactionsApplication } from '../BankingTransactionsApplication.service';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('banking/uncategorized') @Controller('banking/uncategorized')
@ApiTags('Banking Uncategorized Transactions') @ApiTags('Banking Uncategorized Transactions')
@ApiCommonHeaders()
export class BankingUncategorizedTransactionsController { export class BankingUncategorizedTransactionsController {
constructor( constructor(
private readonly bankingTransactionsApplication: BankingTransactionsApplication, private readonly bankingTransactionsApplication: BankingTransactionsApplication,
@@ -35,9 +37,10 @@ export class BankingUncategorizedTransactionsController {
description: 'Uncategorize transactions ID', description: 'Uncategorize transactions ID',
}) })
async getAutofillCategorizeTransaction( async getAutofillCategorizeTransaction(
@Query('uncategorizedTransactionIds') uncategorizedTransactionIds: Array<number> | number, @Query('uncategorizedTransactionIds')
uncategorizedTransactionIds: Array<number> | number,
) { ) {
console.log(uncategorizedTransactionIds) console.log(uncategorizedTransactionIds);
return this.bankingTransactionsApplication.getAutofillCategorizeTransaction( return this.bankingTransactionsApplication.getAutofillCategorizeTransaction(
uncategorizedTransactionIds, uncategorizedTransactionIds,
); );

View File

@@ -18,10 +18,12 @@ import {
getSchemaPath, getSchemaPath,
} from '@nestjs/swagger'; } from '@nestjs/swagger';
import { GetExcludedBankTransactionResponseDto } from './dtos/GetExcludedBankTransactionResponse.dto'; import { GetExcludedBankTransactionResponseDto } from './dtos/GetExcludedBankTransactionResponse.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('banking/exclude') @Controller('banking/exclude')
@ApiTags('Banking Transactions') @ApiTags('Banking Transactions')
@ApiExtraModels(GetExcludedBankTransactionResponseDto) @ApiExtraModels(GetExcludedBankTransactionResponseDto)
@ApiCommonHeaders()
export class BankingTransactionsExcludeController { export class BankingTransactionsExcludeController {
constructor( constructor(
private readonly excludeBankTransactionsApplication: ExcludeBankTransactionsApplication, private readonly excludeBankTransactionsApplication: ExcludeBankTransactionsApplication,

View File

@@ -14,9 +14,11 @@ import { BillAllocatedLandedCostTransactions } from './commands/BillAllocatedLan
import { RevertAllocatedLandedCost } from './commands/RevertAllocatedLandedCost.service'; import { RevertAllocatedLandedCost } from './commands/RevertAllocatedLandedCost.service';
import { LandedCostTranasctions } from './commands/LandedCostTransactions.service'; import { LandedCostTranasctions } from './commands/LandedCostTransactions.service';
import { LandedCostTransactionsQueryDto } from './dtos/LandedCostTransactionsQuery.dto'; import { LandedCostTransactionsQueryDto } from './dtos/LandedCostTransactionsQuery.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@ApiTags('Landed Cost') @ApiTags('Landed Cost')
@Controller('landed-cost') @Controller('landed-cost')
@ApiCommonHeaders()
export class BillAllocateLandedCostController { export class BillAllocateLandedCostController {
constructor( constructor(
private allocateLandedCost: AllocateLandedCostService, private allocateLandedCost: AllocateLandedCostService,

View File

@@ -25,11 +25,13 @@ import { GetBillPaymentsFilterDto } from './dtos/GetBillPaymentsFilter.dto';
import { BillPaymentsPages } from './commands/BillPaymentsPages.service'; import { BillPaymentsPages } from './commands/BillPaymentsPages.service';
import { BillPaymentResponseDto } from './dtos/BillPaymentResponse.dto'; import { BillPaymentResponseDto } from './dtos/BillPaymentResponse.dto';
import { PaginatedResponseDto } from '@/common/dtos/PaginatedResults.dto'; import { PaginatedResponseDto } from '@/common/dtos/PaginatedResults.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('bill-payments') @Controller('bill-payments')
@ApiTags('Bill Payments') @ApiTags('Bill Payments')
@ApiExtraModels(BillPaymentResponseDto) @ApiExtraModels(BillPaymentResponseDto)
@ApiExtraModels(PaginatedResponseDto) @ApiExtraModels(PaginatedResponseDto)
@ApiCommonHeaders()
export class BillPaymentsController { export class BillPaymentsController {
constructor( constructor(
private billPaymentsApplication: BillPaymentsApplication, private billPaymentsApplication: BillPaymentsApplication,

View File

@@ -21,11 +21,13 @@ import { IBillsFilter } from './Bills.types';
import { CreateBillDto, EditBillDto } from './dtos/Bill.dto'; import { CreateBillDto, EditBillDto } from './dtos/Bill.dto';
import { BillResponseDto } from './dtos/BillResponse.dto'; import { BillResponseDto } from './dtos/BillResponse.dto';
import { PaginatedResponseDto } from '@/common/dtos/PaginatedResults.dto'; import { PaginatedResponseDto } from '@/common/dtos/PaginatedResults.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('bills') @Controller('bills')
@ApiTags('Bills') @ApiTags('Bills')
@ApiExtraModels(BillResponseDto) @ApiExtraModels(BillResponseDto)
@ApiExtraModels(PaginatedResponseDto) @ApiExtraModels(PaginatedResponseDto)
@ApiCommonHeaders()
export class BillsController { export class BillsController {
constructor(private billsApplication: BillsApplication) {} constructor(private billsApplication: BillsApplication) {}

View File

@@ -17,10 +17,12 @@ import {
getSchemaPath, getSchemaPath,
} from '@nestjs/swagger'; } from '@nestjs/swagger';
import { BranchResponseDto } from './dtos/BranchResponse.dto'; import { BranchResponseDto } from './dtos/BranchResponse.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('branches') @Controller('branches')
@ApiTags('Branches') @ApiTags('Branches')
@ApiExtraModels(BranchResponseDto) @ApiExtraModels(BranchResponseDto)
@ApiCommonHeaders()
export class BranchesController { export class BranchesController {
constructor(private readonly branchesApplication: BranchesApplication) {} constructor(private readonly branchesApplication: BranchesApplication) {}

View File

@@ -4,9 +4,11 @@ import { ICreditNoteRefundDTO } from '../CreditNotes/types/CreditNotes.types';
import { CreditNotesRefundsApplication } from './CreditNotesRefundsApplication.service'; import { CreditNotesRefundsApplication } from './CreditNotesRefundsApplication.service';
import { RefundCreditNote } from './models/RefundCreditNote'; import { RefundCreditNote } from './models/RefundCreditNote';
import { CreditNoteRefundDto } from './dto/CreditNoteRefund.dto'; import { CreditNoteRefundDto } from './dto/CreditNoteRefund.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('credit-notes') @Controller('credit-notes')
@ApiTags('Credit Note Refunds') @ApiTags('Credit Note Refunds')
@ApiCommonHeaders()
export class CreditNoteRefundsController { export class CreditNoteRefundsController {
constructor( constructor(
private readonly creditNotesRefundsApplication: CreditNotesRefundsApplication, private readonly creditNotesRefundsApplication: CreditNotesRefundsApplication,

View File

@@ -21,11 +21,13 @@ import { ICreditNotesQueryDTO } from './types/CreditNotes.types';
import { CreateCreditNoteDto, EditCreditNoteDto } from './dtos/CreditNote.dto'; import { CreateCreditNoteDto, EditCreditNoteDto } from './dtos/CreditNote.dto';
import { CreditNoteResponseDto } from './dtos/CreditNoteResponse.dto'; import { CreditNoteResponseDto } from './dtos/CreditNoteResponse.dto';
import { PaginatedResponseDto } from '@/common/dtos/PaginatedResults.dto'; import { PaginatedResponseDto } from '@/common/dtos/PaginatedResults.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('credit-notes') @Controller('credit-notes')
@ApiTags('Credit Notes') @ApiTags('Credit Notes')
@ApiExtraModels(CreditNoteResponseDto) @ApiExtraModels(CreditNoteResponseDto)
@ApiExtraModels(PaginatedResponseDto) @ApiExtraModels(PaginatedResponseDto)
@ApiCommonHeaders()
export class CreditNotesController { export class CreditNotesController {
/** /**
* @param {CreditNoteApplication} creditNoteApplication - The credit note application service. * @param {CreditNoteApplication} creditNoteApplication - The credit note application service.

View File

@@ -23,10 +23,12 @@ import { CurrenciesApplication } from './CurrenciesApplication.service';
import { CreateCurrencyDto } from './dtos/CreateCurrency.dto'; import { CreateCurrencyDto } from './dtos/CreateCurrency.dto';
import { EditCurrencyDto } from './dtos/EditCurrency.dto'; import { EditCurrencyDto } from './dtos/EditCurrency.dto';
import { CurrencyResponseDto } from './dtos/CurrencyResponse.dto'; import { CurrencyResponseDto } from './dtos/CurrencyResponse.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@ApiTags('Currencies') @ApiTags('Currencies')
@Controller('/currencies') @Controller('/currencies')
@ApiExtraModels(CurrencyResponseDto) @ApiExtraModels(CurrencyResponseDto)
@ApiCommonHeaders()
export class CurrenciesController { export class CurrenciesController {
constructor(private readonly currenciesApp: CurrenciesApplication) {} constructor(private readonly currenciesApp: CurrenciesApplication) {}

View File

@@ -24,10 +24,12 @@ import { CreateCustomerDto } from './dtos/CreateCustomer.dto';
import { EditCustomerDto } from './dtos/EditCustomer.dto'; import { EditCustomerDto } from './dtos/EditCustomer.dto';
import { CustomerResponseDto } from './dtos/CustomerResponse.dto'; import { CustomerResponseDto } from './dtos/CustomerResponse.dto';
import { GetCustomersQueryDto } from './dtos/GetCustomersQuery.dto'; import { GetCustomersQueryDto } from './dtos/GetCustomersQuery.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('customers') @Controller('customers')
@ApiTags('Customers') @ApiTags('Customers')
@ApiExtraModels(CustomerResponseDto) @ApiExtraModels(CustomerResponseDto)
@ApiCommonHeaders()
export class CustomersController { export class CustomersController {
constructor(private customersApplication: CustomersApplication) {} constructor(private customersApplication: CustomersApplication) {}

View File

@@ -20,10 +20,12 @@ import {
import { CreateExpenseDto, EditExpenseDto } from './dtos/Expense.dto'; import { CreateExpenseDto, EditExpenseDto } from './dtos/Expense.dto';
import { PaginatedResponseDto } from '@/common/dtos/PaginatedResults.dto'; import { PaginatedResponseDto } from '@/common/dtos/PaginatedResults.dto';
import { ExpenseResponseDto } from './dtos/ExpenseResponse.dto'; import { ExpenseResponseDto } from './dtos/ExpenseResponse.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('expenses') @Controller('expenses')
@ApiTags('Expenses') @ApiTags('Expenses')
@ApiExtraModels(PaginatedResponseDto, ExpenseResponseDto) @ApiExtraModels(PaginatedResponseDto, ExpenseResponseDto)
@ApiCommonHeaders()
export class ExpensesController { export class ExpensesController {
constructor(private readonly expensesApplication: ExpensesApplication) {} constructor(private readonly expensesApplication: ExpensesApplication) {}

View File

@@ -10,9 +10,11 @@ import {
} from '@nestjs/swagger'; } from '@nestjs/swagger';
import { APAgingSummaryQueryDto } from './APAgingSummaryQuery.dto'; import { APAgingSummaryQueryDto } from './APAgingSummaryQuery.dto';
import { APAgingSummaryResponseExample } from './APAgingSummary.swagger'; import { APAgingSummaryResponseExample } from './APAgingSummary.swagger';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('reports/payable-aging-summary') @Controller('reports/payable-aging-summary')
@ApiTags('Reports') @ApiTags('Reports')
@ApiCommonHeaders()
export class APAgingSummaryController { export class APAgingSummaryController {
constructor(private readonly APAgingSummaryApp: APAgingSummaryApplication) {} constructor(private readonly APAgingSummaryApp: APAgingSummaryApplication) {}

View File

@@ -11,9 +11,11 @@ import {
} from '@nestjs/swagger'; } from '@nestjs/swagger';
import { ARAgingSummaryQueryDto } from './ARAgingSummaryQuery.dto'; import { ARAgingSummaryQueryDto } from './ARAgingSummaryQuery.dto';
import { ARAgingSummaryResponseExample } from './ARAgingSummary.swagger'; import { ARAgingSummaryResponseExample } from './ARAgingSummary.swagger';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('reports/receivable-aging-summary') @Controller('reports/receivable-aging-summary')
@ApiTags('Reports') @ApiTags('Reports')
@ApiCommonHeaders()
export class ARAgingSummaryController { export class ARAgingSummaryController {
constructor(private readonly ARAgingSummaryApp: ARAgingSummaryApplication) {} constructor(private readonly ARAgingSummaryApp: ARAgingSummaryApplication) {}

View File

@@ -10,9 +10,11 @@ import {
} from '@nestjs/swagger'; } from '@nestjs/swagger';
import { BalanceSheetQueryDto } from './BalanceSheet.dto'; import { BalanceSheetQueryDto } from './BalanceSheet.dto';
import { BalanceSheetResponseExample } from './BalanceSheet.swagger'; import { BalanceSheetResponseExample } from './BalanceSheet.swagger';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('/reports/balance-sheet') @Controller('/reports/balance-sheet')
@ApiTags('Reports') @ApiTags('Reports')
@ApiCommonHeaders()
export class BalanceSheetStatementController { export class BalanceSheetStatementController {
constructor(private readonly balanceSheetApp: BalanceSheetApplication) {} constructor(private readonly balanceSheetApp: BalanceSheetApplication) {}

View File

@@ -10,9 +10,11 @@ import {
} from '@nestjs/swagger'; } from '@nestjs/swagger';
import { CashFlowStatementQueryDto } from './CashFlowStatementQuery.dto'; import { CashFlowStatementQueryDto } from './CashFlowStatementQuery.dto';
import { CashflowStatementResponseExample } from './CashflowStatement.swagger'; import { CashflowStatementResponseExample } from './CashflowStatement.swagger';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('reports/cashflow-statement') @Controller('reports/cashflow-statement')
@ApiTags('Reports') @ApiTags('Reports')
@ApiCommonHeaders()
export class CashflowController { export class CashflowController {
constructor(private readonly cashflowSheetApp: CashflowSheetApplication) {} constructor(private readonly cashflowSheetApp: CashflowSheetApplication) {}

View File

@@ -9,9 +9,11 @@ import { Controller, Get, Headers, Query, Res } from '@nestjs/common';
import { CustomerBalanceSummaryApplication } from './CustomerBalanceSummaryApplication'; import { CustomerBalanceSummaryApplication } from './CustomerBalanceSummaryApplication';
import { CustomerBalanceSummaryQueryDto } from './CustomerBalanceSummaryQuery.dto'; import { CustomerBalanceSummaryQueryDto } from './CustomerBalanceSummaryQuery.dto';
import { AcceptType } from '@/constants/accept-type'; import { AcceptType } from '@/constants/accept-type';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('/reports/customer-balance-summary') @Controller('/reports/customer-balance-summary')
@ApiTags('Reports') @ApiTags('Reports')
@ApiCommonHeaders()
export class CustomerBalanceSummaryController { export class CustomerBalanceSummaryController {
constructor( constructor(
private readonly customerBalanceSummaryApp: CustomerBalanceSummaryApplication, private readonly customerBalanceSummaryApp: CustomerBalanceSummaryApplication,

View File

@@ -10,9 +10,11 @@ import { GeneralLedgerApplication } from './GeneralLedgerApplication';
import { AcceptType } from '@/constants/accept-type'; import { AcceptType } from '@/constants/accept-type';
import { GeneralLedgerQueryDto } from './GeneralLedgerQuery.dto'; import { GeneralLedgerQueryDto } from './GeneralLedgerQuery.dto';
import { GeneralLedgerResponseExample } from './GeneralLedger.swagger'; import { GeneralLedgerResponseExample } from './GeneralLedger.swagger';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('/reports/general-ledger') @Controller('/reports/general-ledger')
@ApiTags('Reports') @ApiTags('Reports')
@ApiCommonHeaders()
export class GeneralLedgerController { export class GeneralLedgerController {
constructor( constructor(
private readonly generalLedgerApplication: GeneralLedgerApplication, private readonly generalLedgerApplication: GeneralLedgerApplication,

View File

@@ -4,9 +4,11 @@ import { Controller, Get, Headers, Query, Res } from '@nestjs/common';
import { InventoryItemDetailsApplication } from './InventoryItemDetailsApplication'; import { InventoryItemDetailsApplication } from './InventoryItemDetailsApplication';
import { AcceptType } from '@/constants/accept-type'; import { AcceptType } from '@/constants/accept-type';
import { InventoryItemDetailsQueryDto } from './InventoryItemDetailsQuery.dto'; import { InventoryItemDetailsQueryDto } from './InventoryItemDetailsQuery.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('reports/inventory-item-details') @Controller('reports/inventory-item-details')
@ApiTags('Reports') @ApiTags('Reports')
@ApiCommonHeaders()
export class InventoryItemDetailsController { export class InventoryItemDetailsController {
constructor( constructor(
private readonly inventoryItemDetailsApp: InventoryItemDetailsApplication, private readonly inventoryItemDetailsApp: InventoryItemDetailsApplication,

View File

@@ -9,9 +9,11 @@ import { Controller, Get, Headers, Query, Res } from '@nestjs/common';
import { InventoryValuationSheetApplication } from './InventoryValuationSheetApplication'; import { InventoryValuationSheetApplication } from './InventoryValuationSheetApplication';
import { InventoryValuationQueryDto } from './InventoryValuationQuery.dto'; import { InventoryValuationQueryDto } from './InventoryValuationQuery.dto';
import { AcceptType } from '@/constants/accept-type'; import { AcceptType } from '@/constants/accept-type';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('reports/inventory-valuation') @Controller('reports/inventory-valuation')
@ApiTags('Reports') @ApiTags('Reports')
@ApiCommonHeaders()
export class InventoryValuationController { export class InventoryValuationController {
constructor( constructor(
private readonly inventoryValuationApp: InventoryValuationSheetApplication, private readonly inventoryValuationApp: InventoryValuationSheetApplication,

View File

@@ -10,9 +10,11 @@ import {
} from '@nestjs/swagger'; } from '@nestjs/swagger';
import { JournalSheetQueryDto } from './JournalSheetQuery.dto'; import { JournalSheetQueryDto } from './JournalSheetQuery.dto';
import { JournalSheetResponseExample } from './JournalSheet.swagger'; import { JournalSheetResponseExample } from './JournalSheet.swagger';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('/reports/journal') @Controller('/reports/journal')
@ApiTags('Reports') @ApiTags('Reports')
@ApiCommonHeaders()
export class JournalSheetController { export class JournalSheetController {
constructor(private readonly journalSheetApp: JournalSheetApplication) {} constructor(private readonly journalSheetApp: JournalSheetApplication) {}

View File

@@ -10,9 +10,11 @@ import {
} from '@nestjs/swagger'; } from '@nestjs/swagger';
import { ProfitLossSheetQueryDto } from './ProfitLossSheetQuery.dto'; import { ProfitLossSheetQueryDto } from './ProfitLossSheetQuery.dto';
import { ProfitLossSheetResponseExample } from './ProfitLossSheet.swagger'; import { ProfitLossSheetResponseExample } from './ProfitLossSheet.swagger';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('/reports/profit-loss-sheet') @Controller('/reports/profit-loss-sheet')
@ApiTags('Reports') @ApiTags('Reports')
@ApiCommonHeaders()
export class ProfitLossSheetController { export class ProfitLossSheetController {
constructor( constructor(
private readonly profitLossSheetApp: ProfitLossSheetApplication, private readonly profitLossSheetApp: ProfitLossSheetApplication,

View File

@@ -4,9 +4,11 @@ import { PurchasesByItemsApplication } from './PurchasesByItemsApplication';
import { AcceptType } from '@/constants/accept-type'; import { AcceptType } from '@/constants/accept-type';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger'; import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { PurchasesByItemsQueryDto } from './PurchasesByItemsQuery.dto'; import { PurchasesByItemsQueryDto } from './PurchasesByItemsQuery.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('/reports/purchases-by-items') @Controller('/reports/purchases-by-items')
@ApiTags('Reports') @ApiTags('Reports')
@ApiCommonHeaders()
export class PurchasesByItemReportController { export class PurchasesByItemReportController {
constructor( constructor(
private readonly purchasesByItemsApp: PurchasesByItemsApplication, private readonly purchasesByItemsApp: PurchasesByItemsApplication,

View File

@@ -12,9 +12,11 @@ import { SalesByItemsApplication } from './SalesByItemsApplication';
import { Response } from 'express'; import { Response } from 'express';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger'; import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { SalesByItemsQueryDto } from './SalesByItemsQuery.dto'; import { SalesByItemsQueryDto } from './SalesByItemsQuery.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('/reports/sales-by-items') @Controller('/reports/sales-by-items')
@ApiTags('Reports') @ApiTags('Reports')
@ApiCommonHeaders()
export class SalesByItemsController { export class SalesByItemsController {
constructor(private readonly salesByItemsApp: SalesByItemsApplication) {} constructor(private readonly salesByItemsApp: SalesByItemsApplication) {}

View File

@@ -9,9 +9,11 @@ import { Controller, Get, Headers, Query, Res } from '@nestjs/common';
import { AcceptType } from '@/constants/accept-type'; import { AcceptType } from '@/constants/accept-type';
import { SalesTaxLiabilitySummaryApplication } from './SalesTaxLiabilitySummaryApplication'; import { SalesTaxLiabilitySummaryApplication } from './SalesTaxLiabilitySummaryApplication';
import { SalesTaxLiabilitySummaryQueryDto } from './dtos/SalesTaxLiabilityQuery.dto'; import { SalesTaxLiabilitySummaryQueryDto } from './dtos/SalesTaxLiabilityQuery.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('/reports/sales-tax-liability-summary') @Controller('/reports/sales-tax-liability-summary')
@ApiTags('Reports') @ApiTags('Reports')
@ApiCommonHeaders()
export class SalesTaxLiabilitySummaryController { export class SalesTaxLiabilitySummaryController {
constructor( constructor(
private readonly salesTaxLiabilitySummaryApp: SalesTaxLiabilitySummaryApplication, private readonly salesTaxLiabilitySummaryApp: SalesTaxLiabilitySummaryApplication,

View File

@@ -5,9 +5,11 @@ import { TransactionsByCustomerApplication } from './TransactionsByCustomersAppl
import { AcceptType } from '@/constants/accept-type'; import { AcceptType } from '@/constants/accept-type';
import { Response } from 'express'; import { Response } from 'express';
import { TransactionsByCustomerQueryDto } from './TransactionsByCustomerQuery.dto'; import { TransactionsByCustomerQueryDto } from './TransactionsByCustomerQuery.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('/reports/transactions-by-customers') @Controller('/reports/transactions-by-customers')
@ApiTags('Reports') @ApiTags('Reports')
@ApiCommonHeaders()
export class TransactionsByCustomerController { export class TransactionsByCustomerController {
constructor( constructor(
private readonly transactionsByCustomersApp: TransactionsByCustomerApplication, private readonly transactionsByCustomersApp: TransactionsByCustomerApplication,

View File

@@ -5,9 +5,11 @@ import { Response } from 'express';
import { TransactionsByVendorApplication } from './TransactionsByVendorApplication'; import { TransactionsByVendorApplication } from './TransactionsByVendorApplication';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger'; import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { TransactionsByVendorQueryDto } from './TransactionsByVendorQuery.dto'; import { TransactionsByVendorQueryDto } from './TransactionsByVendorQuery.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('/reports/transactions-by-vendors') @Controller('/reports/transactions-by-vendors')
@ApiTags('Reports') @ApiTags('Reports')
@ApiCommonHeaders()
export class TransactionsByVendorController { export class TransactionsByVendorController {
constructor( constructor(
private readonly transactionsByVendorsApp: TransactionsByVendorApplication, private readonly transactionsByVendorsApp: TransactionsByVendorApplication,

View File

@@ -11,9 +11,11 @@ import { AcceptType } from '@/constants/accept-type';
import { TrialBalanceSheetApplication } from './TrialBalanceSheetApplication'; import { TrialBalanceSheetApplication } from './TrialBalanceSheetApplication';
import { TrialBalanceSheetQueryDto } from './TrialBalanceSheetQuery.dto'; import { TrialBalanceSheetQueryDto } from './TrialBalanceSheetQuery.dto';
import { TrialBalanceSheetResponseExample } from './TrialBalanceSheet.swagger'; import { TrialBalanceSheetResponseExample } from './TrialBalanceSheet.swagger';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('reports/trial-balance-sheet') @Controller('reports/trial-balance-sheet')
@ApiTags('Reports') @ApiTags('Reports')
@ApiCommonHeaders()
export class TrialBalanceSheetController { export class TrialBalanceSheetController {
constructor( constructor(
private readonly trialBalanceSheetApp: TrialBalanceSheetApplication, private readonly trialBalanceSheetApp: TrialBalanceSheetApplication,

View File

@@ -10,9 +10,11 @@ import {
ApiTags, ApiTags,
} from '@nestjs/swagger'; } from '@nestjs/swagger';
import { VendorBalanceSummaryQueryDto } from './VendorBalanceSummaryQuery.dto'; import { VendorBalanceSummaryQueryDto } from './VendorBalanceSummaryQuery.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('/reports/vendor-balance-summary') @Controller('/reports/vendor-balance-summary')
@ApiTags('Reports') @ApiTags('Reports')
@ApiCommonHeaders()
export class VendorBalanceSummaryController { export class VendorBalanceSummaryController {
constructor( constructor(
private readonly vendorBalanceSummaryApp: VendorBalanceSummaryApplication, private readonly vendorBalanceSummaryApp: VendorBalanceSummaryApplication,

View File

@@ -16,9 +16,11 @@ import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
import { ImportResourceApplication } from './ImportResourceApplication'; import { ImportResourceApplication } from './ImportResourceApplication';
import { uploadImportFileMulterOptions } from './ImportMulter.utils'; import { uploadImportFileMulterOptions } from './ImportMulter.utils';
import { parseJsonSafe } from '@/utils/parse-json'; import { parseJsonSafe } from '@/utils/parse-json';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('import') @Controller('import')
@ApiTags('Import') @ApiTags('Import')
@ApiCommonHeaders()
export class ImportController { export class ImportController {
constructor(private readonly importResourceApp: ImportResourceApplication) {} constructor(private readonly importResourceApp: ImportResourceApplication) {}

View File

@@ -20,10 +20,12 @@ import { IInventoryAdjustmentsFilter } from './types/InventoryAdjustments.types'
import { InventoryAdjustment } from './models/InventoryAdjustment'; import { InventoryAdjustment } from './models/InventoryAdjustment';
import { CreateQuickInventoryAdjustmentDto } from './dtos/CreateQuickInventoryAdjustment.dto'; import { CreateQuickInventoryAdjustmentDto } from './dtos/CreateQuickInventoryAdjustment.dto';
import { InventoryAdjustmentResponseDto } from './dtos/InventoryAdjustmentResponse.dto'; import { InventoryAdjustmentResponseDto } from './dtos/InventoryAdjustmentResponse.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('inventory-adjustments') @Controller('inventory-adjustments')
@ApiTags('Inventory Adjustments') @ApiTags('Inventory Adjustments')
@ApiExtraModels(InventoryAdjustmentResponseDto) @ApiExtraModels(InventoryAdjustmentResponseDto)
@ApiCommonHeaders()
export class InventoryAdjustmentsController { export class InventoryAdjustmentsController {
constructor( constructor(
private readonly inventoryAdjustmentsApplicationService: InventoryAdjustmentsApplicationService, private readonly inventoryAdjustmentsApplicationService: InventoryAdjustmentsApplicationService,

View File

@@ -2,9 +2,11 @@ import { Controller, Get, Query } from '@nestjs/common';
import { GetItemsInventoryValuationListService } from './queries/GetItemsInventoryValuationList.service'; import { GetItemsInventoryValuationListService } from './queries/GetItemsInventoryValuationList.service';
import { GetInventoyItemsCostQueryDto } from './dtos/GetInventoryItemsCostQuery.dto'; import { GetInventoyItemsCostQueryDto } from './dtos/GetInventoryItemsCostQuery.dto';
import { ApiOperation, ApiTags } from '@nestjs/swagger'; import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('inventory-cost') @Controller('inventory-cost')
@ApiTags('Inventory Cost') @ApiTags('Inventory Cost')
@ApiCommonHeaders()
export class InventoryCostController { export class InventoryCostController {
constructor( constructor(
private readonly inventoryItemCost: GetItemsInventoryValuationListService, private readonly inventoryItemCost: GetItemsInventoryValuationListService,

View File

@@ -25,10 +25,12 @@ import {
EditItemCategoryDto, EditItemCategoryDto,
} from './dtos/ItemCategory.dto'; } from './dtos/ItemCategory.dto';
import { ItemCategoryResponseDto } from './dtos/ItemCategoryResponse.dto'; import { ItemCategoryResponseDto } from './dtos/ItemCategoryResponse.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('item-categories') @Controller('item-categories')
@ApiTags('Item Categories') @ApiTags('Item Categories')
@ApiExtraModels(ItemCategoryResponseDto) @ApiExtraModels(ItemCategoryResponseDto)
@ApiCommonHeaders()
export class ItemCategoryController { export class ItemCategoryController {
constructor( constructor(
private readonly itemCategoryApplication: ItemCategoryApplication, private readonly itemCategoryApplication: ItemCategoryApplication,

View File

@@ -4,7 +4,6 @@ import {
Delete, Delete,
Param, Param,
Post, Post,
UseGuards,
Patch, Patch,
Get, Get,
Put, Put,
@@ -29,6 +28,7 @@ import { ItemInvoiceResponseDto } from './dtos/itemInvoiceResponse.dto';
import { ItemEstimatesResponseDto } from './dtos/ItemEstimatesResponse.dto'; import { ItemEstimatesResponseDto } from './dtos/ItemEstimatesResponse.dto';
import { ItemBillsResponseDto } from './dtos/itemBillsResponse.dto'; import { ItemBillsResponseDto } from './dtos/itemBillsResponse.dto';
import { ItemReceiptsResponseDto } from './dtos/ItemReceiptsResponse.dto'; import { ItemReceiptsResponseDto } from './dtos/ItemReceiptsResponse.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('/items') @Controller('/items')
@ApiTags('Items') @ApiTags('Items')
@@ -39,6 +39,7 @@ import { ItemReceiptsResponseDto } from './dtos/ItemReceiptsResponse.dto';
@ApiExtraModels(ItemBillsResponseDto) @ApiExtraModels(ItemBillsResponseDto)
@ApiExtraModels(ItemEstimatesResponseDto) @ApiExtraModels(ItemEstimatesResponseDto)
@ApiExtraModels(ItemReceiptsResponseDto) @ApiExtraModels(ItemReceiptsResponseDto)
@ApiCommonHeaders()
export class ItemsController extends TenantController { export class ItemsController extends TenantController {
constructor(private readonly itemsApplication: ItemsApplicationService) { constructor(private readonly itemsApplication: ItemsApplicationService) {
super(); super();

View File

@@ -24,10 +24,12 @@ import {
} from './dtos/ManualJournal.dto'; } from './dtos/ManualJournal.dto';
import { IManualJournalsFilter } from './types/ManualJournals.types'; import { IManualJournalsFilter } from './types/ManualJournals.types';
import { ManualJournalResponseDto } from './dtos/ManualJournalResponse.dto'; import { ManualJournalResponseDto } from './dtos/ManualJournalResponse.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('manual-journals') @Controller('manual-journals')
@ApiTags('Manual Journals') @ApiTags('Manual Journals')
@ApiExtraModels(ManualJournalResponseDto) @ApiExtraModels(ManualJournalResponseDto)
@ApiCommonHeaders()
export class ManualJournalsController { export class ManualJournalsController {
constructor(private manualJournalsApplication: ManualJournalsApplication) {} constructor(private manualJournalsApplication: ManualJournalsApplication) {}

View File

@@ -33,12 +33,14 @@ import {
OrganizationBuiltResponseExample, OrganizationBuiltResponseExample,
} from './Organization.swagger'; } from './Organization.swagger';
import { GetCurrentOrganizationResponseDto } from './dtos/GetCurrentOrganizationResponse.dto'; import { GetCurrentOrganizationResponseDto } from './dtos/GetCurrentOrganizationResponse.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@ApiTags('Organization') @ApiTags('Organization')
@Controller('organization') @Controller('organization')
@IgnoreTenantInitializedRoute() @IgnoreTenantInitializedRoute()
@IgnoreTenantSeededRoute() @IgnoreTenantSeededRoute()
@ApiExtraModels(GetCurrentOrganizationResponseDto) @ApiExtraModels(GetCurrentOrganizationResponseDto)
@ApiCommonHeaders()
export class OrganizationController { export class OrganizationController {
constructor( constructor(
private readonly buildOrganizationService: BuildOrganizationService, private readonly buildOrganizationService: BuildOrganizationService,

View File

@@ -2,9 +2,11 @@ import { Response } from 'express';
import { Controller, Get, Param, Res } from '@nestjs/common'; import { Controller, Get, Param, Res } from '@nestjs/common';
import { PaymentLinksApplication } from './PaymentLinksApplication'; import { PaymentLinksApplication } from './PaymentLinksApplication';
import { ApiOperation, ApiParam, ApiResponse, ApiTags } from '@nestjs/swagger'; import { ApiOperation, ApiParam, ApiResponse, ApiTags } from '@nestjs/swagger';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('payment-links') @Controller('payment-links')
@ApiTags('Payment Links') @ApiTags('Payment Links')
@ApiCommonHeaders()
export class PaymentLinksController { export class PaymentLinksController {
constructor(private readonly paymentLinkApp: PaymentLinksApplication) {} constructor(private readonly paymentLinkApp: PaymentLinksApplication) {}

View File

@@ -31,12 +31,14 @@ import { AcceptType } from '@/constants/accept-type';
import { PaymentReceivedResponseDto } from './dtos/PaymentReceivedResponse.dto'; import { PaymentReceivedResponseDto } from './dtos/PaymentReceivedResponse.dto';
import { PaginatedResponseDto } from '@/common/dtos/PaginatedResults.dto'; import { PaginatedResponseDto } from '@/common/dtos/PaginatedResults.dto';
import { PaymentReceivedStateResponseDto } from './dtos/PaymentReceivedStateResponse.dto'; import { PaymentReceivedStateResponseDto } from './dtos/PaymentReceivedStateResponse.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('payments-received') @Controller('payments-received')
@ApiTags('Payments Received') @ApiTags('Payments Received')
@ApiExtraModels(PaymentReceivedResponseDto) @ApiExtraModels(PaymentReceivedResponseDto)
@ApiExtraModels(PaginatedResponseDto) @ApiExtraModels(PaginatedResponseDto)
@ApiExtraModels(PaymentReceivedStateResponseDto) @ApiExtraModels(PaymentReceivedStateResponseDto)
@ApiCommonHeaders()
export class PaymentReceivesController { export class PaymentReceivesController {
constructor(private paymentReceivesApplication: PaymentReceivesApplication) {} constructor(private paymentReceivesApplication: PaymentReceivesApplication) {}

View File

@@ -10,9 +10,11 @@ import {
} from '@nestjs/common'; } from '@nestjs/common';
import { PdfTemplateApplication } from './PdfTemplate.application'; import { PdfTemplateApplication } from './PdfTemplate.application';
import { ICreateInvoicePdfTemplateDTO, IEditPdfTemplateDTO } from './types'; import { ICreateInvoicePdfTemplateDTO, IEditPdfTemplateDTO } from './types';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('pdf-templates') @Controller('pdf-templates')
@ApiTags('Pdf Templates') @ApiTags('Pdf Templates')
@ApiCommonHeaders()
export class PdfTemplatesController { export class PdfTemplatesController {
constructor( constructor(
private readonly pdfTemplateApplication: PdfTemplateApplication, private readonly pdfTemplateApplication: PdfTemplateApplication,

View File

@@ -5,12 +5,11 @@ import {
Delete, Delete,
Param, Param,
Body, Body,
Res,
Next, Next,
HttpStatus, HttpStatus,
ParseIntPipe, ParseIntPipe,
} from '@nestjs/common'; } from '@nestjs/common';
import { Response, NextFunction } from 'express'; import { NextFunction } from 'express';
import { CreateRoleDto, EditRoleDto } from './dtos/Role.dto'; import { CreateRoleDto, EditRoleDto } from './dtos/Role.dto';
import { RolesApplication } from './Roles.application'; import { RolesApplication } from './Roles.application';
import { import {
@@ -23,10 +22,12 @@ import {
ApiExtraModels, ApiExtraModels,
} from '@nestjs/swagger'; } from '@nestjs/swagger';
import { RoleResponseDto } from './dtos/RoleResponse.dto'; import { RoleResponseDto } from './dtos/RoleResponse.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@ApiTags('Roles') @ApiTags('Roles')
@Controller('roles') @Controller('roles')
@ApiExtraModels(RoleResponseDto) @ApiExtraModels(RoleResponseDto)
@ApiCommonHeaders()
export class RolesController { export class RolesController {
constructor(private readonly rolesApp: RolesApplication) {} constructor(private readonly rolesApp: RolesApplication) {}

View File

@@ -35,12 +35,14 @@ import { Response } from 'express';
import { SaleEstimateResponseDto } from './dtos/SaleEstimateResponse.dto'; import { SaleEstimateResponseDto } from './dtos/SaleEstimateResponse.dto';
import { PaginatedResponseDto } from '@/common/dtos/PaginatedResults.dto'; import { PaginatedResponseDto } from '@/common/dtos/PaginatedResults.dto';
import { SaleEstiamteStateResponseDto } from './dtos/SaleEstimateStateResponse.dto'; import { SaleEstiamteStateResponseDto } from './dtos/SaleEstimateStateResponse.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('sale-estimates') @Controller('sale-estimates')
@ApiTags('Sale Estimates') @ApiTags('Sale Estimates')
@ApiExtraModels(SaleEstimateResponseDto) @ApiExtraModels(SaleEstimateResponseDto)
@ApiExtraModels(PaginatedResponseDto) @ApiExtraModels(PaginatedResponseDto)
@ApiExtraModels(SaleEstiamteStateResponseDto) @ApiExtraModels(SaleEstiamteStateResponseDto)
@ApiCommonHeaders()
export class SaleEstimatesController { export class SaleEstimatesController {
/** /**
* @param {SaleEstimatesApplication} saleEstimatesApplication - Sale estimates application. * @param {SaleEstimatesApplication} saleEstimatesApplication - Sale estimates application.

View File

@@ -21,7 +21,6 @@ import {
} from './SaleInvoice.types'; } from './SaleInvoice.types';
import { SaleInvoiceApplication } from './SaleInvoices.application'; import { SaleInvoiceApplication } from './SaleInvoices.application';
import { import {
ApiHeader,
ApiOperation, ApiOperation,
ApiParam, ApiParam,
ApiQuery, ApiQuery,
@@ -39,6 +38,7 @@ import { SaleInvoiceResponseDto } from './dtos/SaleInvoiceResponse.dto';
import { PaginatedResponseDto } from '@/common/dtos/PaginatedResults.dto'; import { PaginatedResponseDto } from '@/common/dtos/PaginatedResults.dto';
import { SaleInvoiceStateResponseDto } from './dtos/SaleInvoiceState.dto'; import { SaleInvoiceStateResponseDto } from './dtos/SaleInvoiceState.dto';
import { GenerateSaleInvoiceSharableLinkResponseDto } from './dtos/generateSaleInvoiceSharableLinkResponse.dto'; import { GenerateSaleInvoiceSharableLinkResponseDto } from './dtos/generateSaleInvoiceSharableLinkResponse.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('sale-invoices') @Controller('sale-invoices')
@ApiTags('Sale Invoices') @ApiTags('Sale Invoices')
@@ -46,16 +46,7 @@ import { GenerateSaleInvoiceSharableLinkResponseDto } from './dtos/generateSaleI
@ApiExtraModels(PaginatedResponseDto) @ApiExtraModels(PaginatedResponseDto)
@ApiExtraModels(SaleInvoiceStateResponseDto) @ApiExtraModels(SaleInvoiceStateResponseDto)
@ApiExtraModels(GenerateSaleInvoiceSharableLinkResponseDto) @ApiExtraModels(GenerateSaleInvoiceSharableLinkResponseDto)
@ApiHeader({ @ApiCommonHeaders()
name: 'organization-id',
description: 'The organization id',
required: true,
})
@ApiHeader({
name: 'x-access-token',
description: 'The authentication token',
required: true,
})
export class SaleInvoicesController { export class SaleInvoicesController {
constructor(private saleInvoiceApplication: SaleInvoiceApplication) {} constructor(private saleInvoiceApplication: SaleInvoiceApplication) {}

View File

@@ -31,12 +31,14 @@ import { Response } from 'express';
import { SaleReceiptResponseDto } from './dtos/SaleReceiptResponse.dto'; import { SaleReceiptResponseDto } from './dtos/SaleReceiptResponse.dto';
import { PaginatedResponseDto } from '@/common/dtos/PaginatedResults.dto'; import { PaginatedResponseDto } from '@/common/dtos/PaginatedResults.dto';
import { SaleReceiptStateResponseDto } from './dtos/SaleReceiptState.dto'; import { SaleReceiptStateResponseDto } from './dtos/SaleReceiptState.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('sale-receipts') @Controller('sale-receipts')
@ApiTags('Sale Receipts') @ApiTags('Sale Receipts')
@ApiExtraModels(SaleReceiptResponseDto) @ApiExtraModels(SaleReceiptResponseDto)
@ApiExtraModels(PaginatedResponseDto) @ApiExtraModels(PaginatedResponseDto)
@ApiExtraModels(SaleReceiptStateResponseDto) @ApiExtraModels(SaleReceiptStateResponseDto)
@ApiCommonHeaders()
export class SaleReceiptsController { export class SaleReceiptsController {
constructor(private saleReceiptApplication: SaleReceiptApplication) {} constructor(private saleReceiptApplication: SaleReceiptApplication) {}

View File

@@ -5,7 +5,6 @@ import {
SystemKnexConnection, SystemKnexConnection,
SystemKnexConnectionConfigure, SystemKnexConnectionConfigure,
} from './SystemDB.constants'; } from './SystemDB.constants';
import { SystemDatabaseController } from './SystemDB.controller';
import { knexSnakeCaseMappers } from 'objection'; import { knexSnakeCaseMappers } from 'objection';
const providers = [ const providers = [
@@ -44,6 +43,5 @@ const providers = [
@Module({ @Module({
providers: [...providers], providers: [...providers],
exports: [...providers], exports: [...providers],
controllers: [SystemDatabaseController],
}) })
export class SystemDatabaseModule {} export class SystemDatabaseModule {}

View File

@@ -17,10 +17,12 @@ import {
} from '@nestjs/swagger'; } from '@nestjs/swagger';
import { CreateTaxRateDto, EditTaxRateDto } from './dtos/TaxRate.dto'; import { CreateTaxRateDto, EditTaxRateDto } from './dtos/TaxRate.dto';
import { TaxRateResponseDto } from './dtos/TaxRateResponse.dto'; import { TaxRateResponseDto } from './dtos/TaxRateResponse.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('tax-rates') @Controller('tax-rates')
@ApiTags('Tax Rates') @ApiTags('Tax Rates')
@ApiExtraModels(TaxRateResponseDto) @ApiExtraModels(TaxRateResponseDto)
@ApiCommonHeaders()
export class TaxRatesController { export class TaxRatesController {
constructor(private readonly taxRatesApplication: TaxRatesApplication) {} constructor(private readonly taxRatesApplication: TaxRatesApplication) {}

View File

@@ -1,16 +1,13 @@
import { Module } from "@nestjs/common"; import { Module } from '@nestjs/common';
import { EnsureTenantIsInitializedGuard } from "./EnsureTenantIsInitialized.guard"; import { EnsureTenantIsInitializedGuard } from './EnsureTenantIsInitialized.guard';
import { TenancyGlobalGuard } from "./TenancyGlobal.guard"; import { TenancyGlobalGuard } from './TenancyGlobal.guard';
import { EnsureTenantIsSeededGuard } from "./EnsureTenantIsSeeded.guards"; import { EnsureTenantIsSeededGuard } from './EnsureTenantIsSeeded.guards';
import { APP_GUARD } from "@nestjs/core"; import { APP_GUARD } from '@nestjs/core';
import { TenancyContext } from "./TenancyContext.service"; import { TenancyContext } from './TenancyContext.service';
import { TenantController } from "./Tenant.controller"; import { TenancyInitializeModelsGuard } from './TenancyInitializeModels.guard';
import { TenancyInitializeModelsGuard } from "./TenancyInitializeModels.guard";
@Module({ @Module({
exports: [TenancyContext], exports: [TenancyContext],
controllers: [TenantController],
providers: [ providers: [
TenancyContext, TenancyContext,
{ {
@@ -23,12 +20,12 @@ import { TenancyInitializeModelsGuard } from "./TenancyInitializeModels.guard";
}, },
{ {
provide: APP_GUARD, provide: APP_GUARD,
useClass: EnsureTenantIsSeededGuard useClass: EnsureTenantIsSeededGuard,
}, },
{ {
provide: APP_GUARD, provide: APP_GUARD,
useClass: TenancyInitializeModelsGuard useClass: TenancyInitializeModelsGuard,
} },
] ],
}) })
export class TenancyModule {} export class TenancyModule {}

View File

@@ -15,10 +15,12 @@ import {
TransactionsLockingDto, TransactionsLockingDto,
} from './dtos/TransactionsLocking.dto'; } from './dtos/TransactionsLocking.dto';
import { TransactionLockingResponseDto } from './dtos/TransactionLockingResponse.dto'; import { TransactionLockingResponseDto } from './dtos/TransactionLockingResponse.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('transactions-locking') @Controller('transactions-locking')
@ApiTags('Transactions Locking') @ApiTags('Transactions Locking')
@ApiExtraModels(TransactionLockingResponseDto) @ApiExtraModels(TransactionLockingResponseDto)
@ApiCommonHeaders()
export class TransactionsLockingController { export class TransactionsLockingController {
constructor( constructor(
private readonly transactionsLockingService: TransactionsLockingService, private readonly transactionsLockingService: TransactionsLockingService,

View File

@@ -11,9 +11,11 @@ import {
import { ApiOperation, ApiTags, ApiResponse } from '@nestjs/swagger'; import { ApiOperation, ApiTags, ApiResponse } from '@nestjs/swagger';
import { UsersApplication } from './Users.application'; import { UsersApplication } from './Users.application';
import { EditUserDto } from './dtos/EditUser.dto'; import { EditUserDto } from './dtos/EditUser.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('users') @Controller('users')
@ApiTags('Users') @ApiTags('Users')
@ApiCommonHeaders()
export class UsersController { export class UsersController {
constructor(private readonly usersApplication: UsersApplication) {} constructor(private readonly usersApplication: UsersApplication) {}

View File

@@ -15,9 +15,11 @@ import {
CreateVendorCreditDto, CreateVendorCreditDto,
EditVendorCreditDto, EditVendorCreditDto,
} from './dtos/VendorCredit.dto'; } from './dtos/VendorCredit.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('vendor-credits') @Controller('vendor-credits')
@ApiTags('Vendor Credits') @ApiTags('Vendor Credits')
@ApiCommonHeaders()
export class VendorCreditsController { export class VendorCreditsController {
constructor( constructor(
private readonly vendorCreditsApplication: VendorCreditsApplicationService, private readonly vendorCreditsApplication: VendorCreditsApplicationService,

View File

@@ -17,9 +17,11 @@ import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { CreateVendorDto } from './dtos/CreateVendor.dto'; import { CreateVendorDto } from './dtos/CreateVendor.dto';
import { EditVendorDto } from './dtos/EditVendor.dto'; import { EditVendorDto } from './dtos/EditVendor.dto';
import { GetVendorsQueryDto } from './dtos/GetVendorsQuery.dto'; import { GetVendorsQueryDto } from './dtos/GetVendorsQuery.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('vendors') @Controller('vendors')
@ApiTags('vendors') @ApiTags('Vendors')
@ApiCommonHeaders()
export class VendorsController { export class VendorsController {
constructor(private vendorsApplication: VendorsApplication) {} constructor(private vendorsApplication: VendorsApplication) {}

View File

@@ -17,10 +17,12 @@ import {
} from '@nestjs/swagger'; } from '@nestjs/swagger';
import { CreateWarehouseDto, EditWarehouseDto } from './dtos/Warehouse.dto'; import { CreateWarehouseDto, EditWarehouseDto } from './dtos/Warehouse.dto';
import { WarehouseResponseDto } from './dtos/WarehouseResponse.dto'; import { WarehouseResponseDto } from './dtos/WarehouseResponse.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('warehouses') @Controller('warehouses')
@ApiTags('Warehouses') @ApiTags('Warehouses')
@ApiExtraModels(WarehouseResponseDto) @ApiExtraModels(WarehouseResponseDto)
@ApiCommonHeaders()
export class WarehousesController { export class WarehousesController {
constructor(private warehousesApplication: WarehousesApplication) {} constructor(private warehousesApplication: WarehousesApplication) {}

View File

@@ -24,10 +24,12 @@ import {
import { GetWarehouseTransfersQueryDto } from '../Warehouses/dtos/GetWarehouseTransfersQuery.dto'; import { GetWarehouseTransfersQueryDto } from '../Warehouses/dtos/GetWarehouseTransfersQuery.dto';
import { WarehouseTransferResponseDto } from './dtos/WarehouseTransferResponse.dto'; import { WarehouseTransferResponseDto } from './dtos/WarehouseTransferResponse.dto';
import { PaginatedResponseDto } from '@/common/dtos/PaginatedResults.dto'; import { PaginatedResponseDto } from '@/common/dtos/PaginatedResults.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('warehouse-transfers') @Controller('warehouse-transfers')
@ApiTags('Warehouse Transfers') @ApiTags('Warehouse Transfers')
@ApiExtraModels(WarehouseTransferResponseDto, PaginatedResponseDto) @ApiExtraModels(WarehouseTransferResponseDto, PaginatedResponseDto)
@ApiCommonHeaders()
export class WarehouseTransfersController { export class WarehouseTransfersController {
/** /**
* @param {WarehouseTransferApplication} warehouseTransferApplication - Warehouse transfer application. * @param {WarehouseTransferApplication} warehouseTransferApplication - Warehouse transfer application.