mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
refaqctor: document openapi endpoints
This commit is contained in:
@@ -13,10 +13,12 @@ import { CreateAccountDTO } from './CreateAccount.dto';
|
|||||||
import { EditAccountDTO } from './EditAccount.dto';
|
import { EditAccountDTO } from './EditAccount.dto';
|
||||||
import { PublicRoute } from '../Auth/Jwt.guard';
|
import { PublicRoute } from '../Auth/Jwt.guard';
|
||||||
import { IAccountsFilter, IAccountsTransactionsFilter } from './Accounts.types';
|
import { IAccountsFilter, IAccountsTransactionsFilter } from './Accounts.types';
|
||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
// import { IAccountsFilter, IAccountsTransactionsFilter } from './Accounts.types';
|
// import { IAccountsFilter, IAccountsTransactionsFilter } from './Accounts.types';
|
||||||
// import { ZodValidationPipe } from '@/common/pipes/ZodValidation.pipe';
|
// import { ZodValidationPipe } from '@/common/pipes/ZodValidation.pipe';
|
||||||
|
|
||||||
@Controller('accounts')
|
@Controller('accounts')
|
||||||
|
@ApiTags('accounts')
|
||||||
@PublicRoute()
|
@PublicRoute()
|
||||||
export class AccountsController {
|
export class AccountsController {
|
||||||
constructor(private readonly accountsApplication: AccountsApplication) {}
|
constructor(private readonly accountsApplication: AccountsApplication) {}
|
||||||
@@ -27,6 +29,7 @@ export class AccountsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Post(':id')
|
@Post(':id')
|
||||||
|
@ApiOperation({ summary: 'Edit the given account.' })
|
||||||
async editAccount(
|
async editAccount(
|
||||||
@Param('id', ParseIntPipe) id: number,
|
@Param('id', ParseIntPipe) id: number,
|
||||||
@Body() accountDTO: EditAccountDTO,
|
@Body() accountDTO: EditAccountDTO,
|
||||||
@@ -35,36 +38,43 @@ export class AccountsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
|
@ApiOperation({ summary: 'Delete the given account.' })
|
||||||
async deleteAccount(@Param('id', ParseIntPipe) id: number) {
|
async deleteAccount(@Param('id', ParseIntPipe) id: number) {
|
||||||
return this.accountsApplication.deleteAccount(id);
|
return this.accountsApplication.deleteAccount(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post(':id/activate')
|
@Post(':id/activate')
|
||||||
|
@ApiOperation({ summary: 'Activate the given account.' })
|
||||||
async activateAccount(@Param('id', ParseIntPipe) id: number) {
|
async activateAccount(@Param('id', ParseIntPipe) id: number) {
|
||||||
return this.accountsApplication.activateAccount(id);
|
return this.accountsApplication.activateAccount(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post(':id/inactivate')
|
@Post(':id/inactivate')
|
||||||
|
@ApiOperation({ summary: 'Inactivate the given account.' })
|
||||||
async inactivateAccount(@Param('id', ParseIntPipe) id: number) {
|
async inactivateAccount(@Param('id', ParseIntPipe) id: number) {
|
||||||
return this.accountsApplication.inactivateAccount(id);
|
return this.accountsApplication.inactivateAccount(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('types')
|
@Get('types')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the account types.' })
|
||||||
async getAccountTypes() {
|
async getAccountTypes() {
|
||||||
return this.accountsApplication.getAccountTypes();
|
return this.accountsApplication.getAccountTypes();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('transactions')
|
@Get('transactions')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the account transactions.' })
|
||||||
async getAccountTransactions(@Query() filter: IAccountsTransactionsFilter) {
|
async getAccountTransactions(@Query() filter: IAccountsTransactionsFilter) {
|
||||||
return this.accountsApplication.getAccountsTransactions(filter);
|
return this.accountsApplication.getAccountsTransactions(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the account details.' })
|
||||||
async getAccount(@Param('id', ParseIntPipe) id: number) {
|
async getAccount(@Param('id', ParseIntPipe) id: number) {
|
||||||
return this.accountsApplication.getAccount(id);
|
return this.accountsApplication.getAccount(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
|
@ApiOperation({ summary: 'Retrieves the accounts.' })
|
||||||
async getAccounts(@Query() filter: IAccountsFilter) {
|
async getAccounts(@Query() filter: IAccountsFilter) {
|
||||||
return this.accountsApplication.getAccounts(filter);
|
return this.accountsApplication.getAccounts(filter);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
import {
|
import {
|
||||||
Body,
|
Body,
|
||||||
Controller,
|
Controller,
|
||||||
@@ -13,11 +14,13 @@ import { PublicRoute } from '../Auth/Jwt.guard';
|
|||||||
import { BankRule } from './models/BankRule';
|
import { BankRule } from './models/BankRule';
|
||||||
|
|
||||||
@Controller('banking/rules')
|
@Controller('banking/rules')
|
||||||
|
@ApiTags('bank-rules')
|
||||||
@PublicRoute()
|
@PublicRoute()
|
||||||
export class BankRulesController {
|
export class BankRulesController {
|
||||||
constructor(private readonly bankRulesApplication: BankRulesApplication) {}
|
constructor(private readonly bankRulesApplication: BankRulesApplication) {}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
|
@ApiOperation({ summary: 'Create a new bank rule.' })
|
||||||
async createBankRule(
|
async createBankRule(
|
||||||
@Body() createRuleDTO: ICreateBankRuleDTO,
|
@Body() createRuleDTO: ICreateBankRuleDTO,
|
||||||
): Promise<BankRule> {
|
): Promise<BankRule> {
|
||||||
@@ -25,6 +28,7 @@ export class BankRulesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id')
|
@Put(':id')
|
||||||
|
@ApiOperation({ summary: 'Edit the given bank rule.' })
|
||||||
async editBankRule(
|
async editBankRule(
|
||||||
@Param('id') ruleId: number,
|
@Param('id') ruleId: number,
|
||||||
@Body() editRuleDTO: IEditBankRuleDTO,
|
@Body() editRuleDTO: IEditBankRuleDTO,
|
||||||
@@ -33,16 +37,19 @@ export class BankRulesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
|
@ApiOperation({ summary: 'Delete the given bank rule.' })
|
||||||
async deleteBankRule(@Param('id') ruleId: number): Promise<void> {
|
async deleteBankRule(@Param('id') ruleId: number): Promise<void> {
|
||||||
return this.bankRulesApplication.deleteBankRule(ruleId);
|
return this.bankRulesApplication.deleteBankRule(ruleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the bank rule details.' })
|
||||||
async getBankRule(@Param('id') ruleId: number): Promise<any> {
|
async getBankRule(@Param('id') ruleId: number): Promise<any> {
|
||||||
return this.bankRulesApplication.getBankRule(ruleId);
|
return this.bankRulesApplication.getBankRule(ruleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
|
@ApiOperation({ summary: 'Retrieves the bank rules.' })
|
||||||
async getBankRules(): Promise<any> {
|
async getBankRules(): Promise<any> {
|
||||||
return this.bankRulesApplication.getBankRules();
|
return this.bankRulesApplication.getBankRules();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,40 @@
|
|||||||
import { Controller, Param, Post } from '@nestjs/common';
|
import { Controller, Param, Post } from '@nestjs/common';
|
||||||
import { BankAccountsApplication } from './BankAccountsApplication.service';
|
import { BankAccountsApplication } from './BankAccountsApplication.service';
|
||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('banking/accounts')
|
@Controller('banking/accounts')
|
||||||
|
@ApiTags('banking-accounts')
|
||||||
export class BankAccountsController {
|
export class BankAccountsController {
|
||||||
constructor(private bankAccountsApplication: BankAccountsApplication) {}
|
constructor(private bankAccountsApplication: BankAccountsApplication) {}
|
||||||
|
|
||||||
@Post(':id/disconnect')
|
@Post(':id/disconnect')
|
||||||
|
@ApiOperation({
|
||||||
|
summary: 'Disconnect the bank connection of the given bank account.',
|
||||||
|
})
|
||||||
async disconnectBankAccount(@Param('id') bankAccountId: number) {
|
async disconnectBankAccount(@Param('id') bankAccountId: number) {
|
||||||
return this.bankAccountsApplication.disconnectBankAccount(bankAccountId);
|
return this.bankAccountsApplication.disconnectBankAccount(bankAccountId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post(':id/refresh')
|
@Post(':id/refresh')
|
||||||
|
@ApiOperation({
|
||||||
|
summary: 'Refresh the bank account transactions.',
|
||||||
|
})
|
||||||
async refreshBankAccount(@Param('id') bankAccountId: number) {
|
async refreshBankAccount(@Param('id') bankAccountId: number) {
|
||||||
return this.bankAccountsApplication.refreshBankAccount(bankAccountId);
|
return this.bankAccountsApplication.refreshBankAccount(bankAccountId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post(':id/pause')
|
@Post(':id/pause')
|
||||||
|
@ApiOperation({
|
||||||
|
summary: 'Pause transactions syncing of the given bank account.',
|
||||||
|
})
|
||||||
async pauseBankAccount(@Param('id') bankAccountId: number) {
|
async pauseBankAccount(@Param('id') bankAccountId: number) {
|
||||||
return this.bankAccountsApplication.pauseBankAccount(bankAccountId);
|
return this.bankAccountsApplication.pauseBankAccount(bankAccountId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post(':id/resume')
|
@Post(':id/resume')
|
||||||
|
@ApiOperation({
|
||||||
|
summary: 'Resume transactions syncing of the given bank account.',
|
||||||
|
})
|
||||||
async resumeBankAccount(@Param('id') bankAccountId: number) {
|
async resumeBankAccount(@Param('id') bankAccountId: number) {
|
||||||
return this.bankAccountsApplication.resumeBankAccount(bankAccountId);
|
return this.bankAccountsApplication.resumeBankAccount(bankAccountId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
|
import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
|
||||||
import { BankingMatchingApplication } from './BankingMatchingApplication';
|
import { BankingMatchingApplication } from './BankingMatchingApplication';
|
||||||
import { GetMatchedTransactionsFilter, IMatchTransactionDTO } from './types';
|
import { GetMatchedTransactionsFilter, IMatchTransactionDTO } from './types';
|
||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('banking/matching')
|
@Controller('banking/matching')
|
||||||
|
@ApiTags('banking-transactions-matching')
|
||||||
export class BankingMatchingController {
|
export class BankingMatchingController {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly bankingMatchingApplication: BankingMatchingApplication
|
private readonly bankingMatchingApplication: BankingMatchingApplication
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@Get('matched/transactions')
|
@Get('matched/transactions')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the matched transactions.' })
|
||||||
async getMatchedTransactions(
|
async getMatchedTransactions(
|
||||||
@Query('uncategorizedTransactionIds') uncategorizedTransactionIds: number[],
|
@Query('uncategorizedTransactionIds') uncategorizedTransactionIds: number[],
|
||||||
@Query() filter: GetMatchedTransactionsFilter
|
@Query() filter: GetMatchedTransactionsFilter
|
||||||
@@ -20,6 +23,7 @@ export class BankingMatchingController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Post('/match/:uncategorizedTransactionId')
|
@Post('/match/:uncategorizedTransactionId')
|
||||||
|
@ApiOperation({ summary: 'Match the given uncategorized transaction.' })
|
||||||
async matchTransaction(
|
async matchTransaction(
|
||||||
@Param('uncategorizedTransactionId') uncategorizedTransactionId: number | number[],
|
@Param('uncategorizedTransactionId') uncategorizedTransactionId: number | number[],
|
||||||
@Body() matchedTransactions: IMatchTransactionDTO[]
|
@Body() matchedTransactions: IMatchTransactionDTO[]
|
||||||
@@ -31,6 +35,7 @@ export class BankingMatchingController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Post('/unmatch/:uncategorizedTransactionId')
|
@Post('/unmatch/:uncategorizedTransactionId')
|
||||||
|
@ApiOperation({ summary: 'Unmatch the given uncategorized transaction.' })
|
||||||
async unmatchMatchedTransaction(
|
async unmatchMatchedTransaction(
|
||||||
@Param('uncategorizedTransactionId') uncategorizedTransactionId: number
|
@Param('uncategorizedTransactionId') uncategorizedTransactionId: number
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -13,8 +13,10 @@ import {
|
|||||||
ICashflowNewCommandDTO,
|
ICashflowNewCommandDTO,
|
||||||
} from './types/BankingTransactions.types';
|
} from './types/BankingTransactions.types';
|
||||||
import { PublicRoute } from '../Auth/Jwt.guard';
|
import { PublicRoute } from '../Auth/Jwt.guard';
|
||||||
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('banking/transactions')
|
@Controller('banking/transactions')
|
||||||
|
@ApiTags('banking-transactions')
|
||||||
@PublicRoute()
|
@PublicRoute()
|
||||||
export class BankingTransactionsController {
|
export class BankingTransactionsController {
|
||||||
constructor(
|
constructor(
|
||||||
|
|||||||
@@ -9,14 +9,17 @@ import {
|
|||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { ExcludeBankTransactionsApplication } from './ExcludeBankTransactionsApplication';
|
import { ExcludeBankTransactionsApplication } from './ExcludeBankTransactionsApplication';
|
||||||
import { ExcludedBankTransactionsQuery } from './types/BankTransactionsExclude.types';
|
import { ExcludedBankTransactionsQuery } from './types/BankTransactionsExclude.types';
|
||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('banking/transactions')
|
@Controller('banking/transactions')
|
||||||
|
@ApiTags('banking-transactions')
|
||||||
export class BankingTransactionsExcludeController {
|
export class BankingTransactionsExcludeController {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly excludeBankTransactionsApplication: ExcludeBankTransactionsApplication,
|
private readonly excludeBankTransactionsApplication: ExcludeBankTransactionsApplication,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
|
@ApiOperation({ summary: 'Retrieves the excluded bank transactions.' })
|
||||||
public getExcludedBankTransactions(
|
public getExcludedBankTransactions(
|
||||||
@Query() query: ExcludedBankTransactionsQuery,
|
@Query() query: ExcludedBankTransactionsQuery,
|
||||||
) {
|
) {
|
||||||
@@ -26,6 +29,7 @@ export class BankingTransactionsExcludeController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Post(':id/exclude')
|
@Post(':id/exclude')
|
||||||
|
@ApiOperation({ summary: 'Exclude the given bank transaction.' })
|
||||||
public excludeBankTransaction(@Param('id') id: string) {
|
public excludeBankTransaction(@Param('id') id: string) {
|
||||||
return this.excludeBankTransactionsApplication.excludeBankTransaction(
|
return this.excludeBankTransactionsApplication.excludeBankTransaction(
|
||||||
Number(id),
|
Number(id),
|
||||||
@@ -33,6 +37,7 @@ export class BankingTransactionsExcludeController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id/exclude')
|
@Delete(':id/exclude')
|
||||||
|
@ApiOperation({ summary: 'Unexclude the given bank transaction.' })
|
||||||
public unexcludeBankTransaction(@Param('id') id: string) {
|
public unexcludeBankTransaction(@Param('id') id: string) {
|
||||||
return this.excludeBankTransactionsApplication.unexcludeBankTransaction(
|
return this.excludeBankTransactionsApplication.unexcludeBankTransaction(
|
||||||
Number(id),
|
Number(id),
|
||||||
@@ -40,11 +45,13 @@ export class BankingTransactionsExcludeController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Post('bulk/exclude')
|
@Post('bulk/exclude')
|
||||||
|
@ApiOperation({ summary: 'Exclude the given bank transactions.' })
|
||||||
public excludeBankTransactions(@Body('ids') ids: number[]) {
|
public excludeBankTransactions(@Body('ids') ids: number[]) {
|
||||||
return this.excludeBankTransactionsApplication.excludeBankTransactions(ids);
|
return this.excludeBankTransactionsApplication.excludeBankTransactions(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete('bulk/exclude')
|
@Delete('bulk/exclude')
|
||||||
|
@ApiOperation({ summary: 'Unexclude the given bank transactions.' })
|
||||||
public unexcludeBankTransactions(@Body('ids') ids: number[]) {
|
public unexcludeBankTransactions(@Body('ids') ids: number[]) {
|
||||||
return this.excludeBankTransactionsApplication.unexcludeBankTransactions(
|
return this.excludeBankTransactionsApplication.unexcludeBankTransactions(
|
||||||
ids,
|
ids,
|
||||||
|
|||||||
@@ -9,17 +9,21 @@ import {
|
|||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { BillPaymentsApplication } from './BillPaymentsApplication.service';
|
import { BillPaymentsApplication } from './BillPaymentsApplication.service';
|
||||||
import { IBillPaymentDTO } from './types/BillPayments.types';
|
import { IBillPaymentDTO } from './types/BillPayments.types';
|
||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('bill-payments')
|
@Controller('bill-payments')
|
||||||
|
@ApiTags('bill-payments')
|
||||||
export class BillPaymentsController {
|
export class BillPaymentsController {
|
||||||
constructor(private billPaymentsApplication: BillPaymentsApplication) {}
|
constructor(private billPaymentsApplication: BillPaymentsApplication) {}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
|
@ApiOperation({ summary: 'Create a new bill payment.' })
|
||||||
public createBillPayment(@Body() billPaymentDTO: IBillPaymentDTO) {
|
public createBillPayment(@Body() billPaymentDTO: IBillPaymentDTO) {
|
||||||
return this.billPaymentsApplication.createBillPayment(billPaymentDTO);
|
return this.billPaymentsApplication.createBillPayment(billPaymentDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':billPaymentId')
|
@Delete(':billPaymentId')
|
||||||
|
@ApiOperation({ summary: 'Delete the given bill payment.' })
|
||||||
public deleteBillPayment(@Param('billPaymentId') billPaymentId: string) {
|
public deleteBillPayment(@Param('billPaymentId') billPaymentId: string) {
|
||||||
return this.billPaymentsApplication.deleteBillPayment(
|
return this.billPaymentsApplication.deleteBillPayment(
|
||||||
Number(billPaymentId),
|
Number(billPaymentId),
|
||||||
@@ -27,6 +31,7 @@ export class BillPaymentsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Put(':billPaymentId')
|
@Put(':billPaymentId')
|
||||||
|
@ApiOperation({ summary: 'Edit the given bill payment.' })
|
||||||
public editBillPayment(
|
public editBillPayment(
|
||||||
@Param('billPaymentId') billPaymentId: string,
|
@Param('billPaymentId') billPaymentId: string,
|
||||||
@Body() billPaymentDTO: IBillPaymentDTO,
|
@Body() billPaymentDTO: IBillPaymentDTO,
|
||||||
@@ -38,11 +43,13 @@ export class BillPaymentsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get(':billPaymentId')
|
@Get(':billPaymentId')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the bill payment details.' })
|
||||||
public getBillPayment(@Param('billPaymentId') billPaymentId: string) {
|
public getBillPayment(@Param('billPaymentId') billPaymentId: string) {
|
||||||
return this.billPaymentsApplication.getBillPayment(Number(billPaymentId));
|
return this.billPaymentsApplication.getBillPayment(Number(billPaymentId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':billPaymentId/bills')
|
@Get(':billPaymentId/bills')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the bills of the given bill payment.' })
|
||||||
public getPaymentBills(@Param('billPaymentId') billPaymentId: string) {
|
public getPaymentBills(@Param('billPaymentId') billPaymentId: string) {
|
||||||
return this.billPaymentsApplication.getPaymentBills(Number(billPaymentId));
|
return this.billPaymentsApplication.getPaymentBills(Number(billPaymentId));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
import {
|
import {
|
||||||
Controller,
|
Controller,
|
||||||
Post,
|
Post,
|
||||||
@@ -9,45 +10,54 @@ import {
|
|||||||
Query,
|
Query,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { BillsApplication } from './Bills.application';
|
import { BillsApplication } from './Bills.application';
|
||||||
import { IBillDTO, IBillEditDTO } from './Bills.types';
|
import { IBillDTO, IBillEditDTO, IBillsFilter } from './Bills.types';
|
||||||
import { PublicRoute } from '../Auth/Jwt.guard';
|
import { PublicRoute } from '../Auth/Jwt.guard';
|
||||||
|
|
||||||
|
|
||||||
@Controller('bills')
|
@Controller('bills')
|
||||||
|
@ApiTags('bills')
|
||||||
@PublicRoute()
|
@PublicRoute()
|
||||||
export class BillsController {
|
export class BillsController {
|
||||||
constructor(private billsApplication: BillsApplication) {}
|
constructor(private billsApplication: BillsApplication) {}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
|
@ApiOperation({ summary: 'Create a new bill.' })
|
||||||
createBill(@Body() billDTO: IBillDTO) {
|
createBill(@Body() billDTO: IBillDTO) {
|
||||||
return this.billsApplication.createBill(billDTO);
|
return this.billsApplication.createBill(billDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id')
|
@Put(':id')
|
||||||
|
@ApiOperation({ summary: 'Edit the given bill.' })
|
||||||
editBill(@Param('id') billId: number, @Body() billDTO: IBillEditDTO) {
|
editBill(@Param('id') billId: number, @Body() billDTO: IBillEditDTO) {
|
||||||
return this.billsApplication.editBill(billId, billDTO);
|
return this.billsApplication.editBill(billId, billDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
|
@ApiOperation({ summary: 'Delete the given bill.' })
|
||||||
deleteBill(@Param('id') billId: number) {
|
deleteBill(@Param('id') billId: number) {
|
||||||
return this.billsApplication.deleteBill(billId);
|
return this.billsApplication.deleteBill(billId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
|
@ApiOperation({ summary: 'Retrieves the bills.' })
|
||||||
getBills(@Query() filterDTO: IBillsFilter) {
|
getBills(@Query() filterDTO: IBillsFilter) {
|
||||||
return this.billsApplication.getBills(filterDTO);
|
return this.billsApplication.getBills(filterDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the bill details.' })
|
||||||
getBill(@Param('id') billId: number) {
|
getBill(@Param('id') billId: number) {
|
||||||
return this.billsApplication.getBill(billId);
|
return this.billsApplication.getBill(billId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post(':id/open')
|
@Post(':id/open')
|
||||||
|
@ApiOperation({ summary: 'Open the given bill.' })
|
||||||
openBill(@Param('id') billId: number) {
|
openBill(@Param('id') billId: number) {
|
||||||
return this.billsApplication.openBill(billId);
|
return this.billsApplication.openBill(billId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('due')
|
@Get('due')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the due bills.' })
|
||||||
getDueBills(@Body('vendorId') vendorId?: number) {
|
getDueBills(@Body('vendorId') vendorId?: number) {
|
||||||
return this.billsApplication.getDueBills(vendorId);
|
return this.billsApplication.getDueBills(vendorId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,43 +10,52 @@ import {
|
|||||||
import { BranchesApplication } from './BranchesApplication.service';
|
import { BranchesApplication } from './BranchesApplication.service';
|
||||||
import { ICreateBranchDTO, IEditBranchDTO } from './Branches.types';
|
import { ICreateBranchDTO, IEditBranchDTO } from './Branches.types';
|
||||||
import { PublicRoute } from '../Auth/Jwt.guard';
|
import { PublicRoute } from '../Auth/Jwt.guard';
|
||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('branches')
|
@Controller('branches')
|
||||||
|
@ApiTags('branches')
|
||||||
@PublicRoute()
|
@PublicRoute()
|
||||||
export class BranchesController {
|
export class BranchesController {
|
||||||
constructor(private readonly branchesApplication: BranchesApplication) {}
|
constructor(private readonly branchesApplication: BranchesApplication) {}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
|
@ApiOperation({ summary: 'Retrieves the branches.' })
|
||||||
getBranches() {
|
getBranches() {
|
||||||
// return this.branchesApplication.getBranches();
|
return this.branchesApplication.getBranches();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the branch details.' })
|
||||||
getBranch(@Param('id') id: string) {
|
getBranch(@Param('id') id: string) {
|
||||||
return this.branchesApplication.getBranch(Number(id));
|
return this.branchesApplication.getBranch(Number(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
|
@ApiOperation({ summary: 'Create a new branch.' })
|
||||||
createBranch(@Body() createBranchDTO: ICreateBranchDTO) {
|
createBranch(@Body() createBranchDTO: ICreateBranchDTO) {
|
||||||
return this.branchesApplication.createBranch(createBranchDTO);
|
return this.branchesApplication.createBranch(createBranchDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id')
|
@Put(':id')
|
||||||
|
@ApiOperation({ summary: 'Edit the given branch.' })
|
||||||
editBranch(@Param('id') id: string, @Body() editBranchDTO: IEditBranchDTO) {
|
editBranch(@Param('id') id: string, @Body() editBranchDTO: IEditBranchDTO) {
|
||||||
return this.branchesApplication.editBranch(Number(id), editBranchDTO);
|
return this.branchesApplication.editBranch(Number(id), editBranchDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
|
@ApiOperation({ summary: 'Delete the given branch.' })
|
||||||
deleteBranch(@Param('id') id: string) {
|
deleteBranch(@Param('id') id: string) {
|
||||||
return this.branchesApplication.deleteBranch(Number(id));
|
return this.branchesApplication.deleteBranch(Number(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post('activate')
|
@Post('activate')
|
||||||
|
@ApiOperation({ summary: 'Activate the branches feature.' })
|
||||||
activateBranches() {
|
activateBranches() {
|
||||||
return this.branchesApplication.activateBranches();
|
return this.branchesApplication.activateBranches();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id/mark-as-primary')
|
@Put(':id/mark-as-primary')
|
||||||
|
@ApiOperation({ summary: 'Mark the given branch as primary.' })
|
||||||
markBranchAsPrimary(@Param('id') id: string) {
|
markBranchAsPrimary(@Param('id') id: string) {
|
||||||
return this.branchesApplication.markBranchAsPrimary(Number(id));
|
return this.branchesApplication.markBranchAsPrimary(Number(id));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ export class BranchesApplication {
|
|||||||
* @param {number} tenantId
|
* @param {number} tenantId
|
||||||
* @returns {IBranch}
|
* @returns {IBranch}
|
||||||
*/
|
*/
|
||||||
// public getBranches = (): Promise<Branch[]> => {
|
public getBranches = (): Promise<Branch[]> => {
|
||||||
// // return this.getBranchesService.getBranches(tenantId);
|
return this.getBranchesService.getBranches();
|
||||||
// };
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the given branch details.
|
* Retrieves the given branch details.
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
import { Body, Controller, Delete, Param, Post } from '@nestjs/common';
|
import { Body, Controller, Delete, Param, Post } from '@nestjs/common';
|
||||||
import { ICreditNoteRefundDTO } from '../CreditNotes/types/CreditNotes.types';
|
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';
|
||||||
|
|
||||||
@Controller('credit-notes')
|
@Controller('credit-notes')
|
||||||
|
@ApiTags('credit-notes-refunds')
|
||||||
export class CreditNoteRefundsController {
|
export class CreditNoteRefundsController {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly creditNotesRefundsApplication: CreditNotesRefundsApplication,
|
private readonly creditNotesRefundsApplication: CreditNotesRefundsApplication,
|
||||||
@@ -16,6 +18,7 @@ export class CreditNoteRefundsController {
|
|||||||
* @returns {Promise<RefundCreditNote>}
|
* @returns {Promise<RefundCreditNote>}
|
||||||
*/
|
*/
|
||||||
@Post(':creditNoteId/refunds')
|
@Post(':creditNoteId/refunds')
|
||||||
|
@ApiOperation({ summary: 'Create a refund for the given credit note.' })
|
||||||
createRefundCreditNote(
|
createRefundCreditNote(
|
||||||
@Param('creditNoteId') creditNoteId: number,
|
@Param('creditNoteId') creditNoteId: number,
|
||||||
@Body() creditNoteDTO: ICreditNoteRefundDTO,
|
@Body() creditNoteDTO: ICreditNoteRefundDTO,
|
||||||
@@ -32,6 +35,7 @@ export class CreditNoteRefundsController {
|
|||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
@Delete('refunds/:refundCreditId')
|
@Delete('refunds/:refundCreditId')
|
||||||
|
@ApiOperation({ summary: 'Delete a refund for the given credit note.' })
|
||||||
deleteRefundCreditNote(
|
deleteRefundCreditNote(
|
||||||
@Param('refundCreditId') refundCreditId: number,
|
@Param('refundCreditId') refundCreditId: number,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
|||||||
@@ -14,23 +14,28 @@ import {
|
|||||||
ICustomerOpeningBalanceEditDTO,
|
ICustomerOpeningBalanceEditDTO,
|
||||||
} from './types/Customers.types';
|
} from './types/Customers.types';
|
||||||
import { PublicRoute } from '../Auth/Jwt.guard';
|
import { PublicRoute } from '../Auth/Jwt.guard';
|
||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('customers')
|
@Controller('customers')
|
||||||
|
@ApiTags('customers')
|
||||||
@PublicRoute()
|
@PublicRoute()
|
||||||
export class CustomersController {
|
export class CustomersController {
|
||||||
constructor(private customersApplication: CustomersApplication) {}
|
constructor(private customersApplication: CustomersApplication) {}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the customer details.' })
|
||||||
getCustomer(@Param('id') customerId: number) {
|
getCustomer(@Param('id') customerId: number) {
|
||||||
return this.customersApplication.getCustomer(customerId);
|
return this.customersApplication.getCustomer(customerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
|
@ApiOperation({ summary: 'Create a new customer.' })
|
||||||
createCustomer(@Body() customerDTO: ICustomerNewDTO) {
|
createCustomer(@Body() customerDTO: ICustomerNewDTO) {
|
||||||
return this.customersApplication.createCustomer(customerDTO);
|
return this.customersApplication.createCustomer(customerDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id')
|
@Put(':id')
|
||||||
|
@ApiOperation({ summary: 'Edit the given customer.' })
|
||||||
editCustomer(
|
editCustomer(
|
||||||
@Param('id') customerId: number,
|
@Param('id') customerId: number,
|
||||||
@Body() customerDTO: ICustomerEditDTO,
|
@Body() customerDTO: ICustomerEditDTO,
|
||||||
@@ -39,11 +44,13 @@ export class CustomersController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
|
@ApiOperation({ summary: 'Delete the given customer.' })
|
||||||
deleteCustomer(@Param('id') customerId: number) {
|
deleteCustomer(@Param('id') customerId: number) {
|
||||||
return this.customersApplication.deleteCustomer(customerId);
|
return this.customersApplication.deleteCustomer(customerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id/opening-balance')
|
@Put(':id/opening-balance')
|
||||||
|
@ApiOperation({ summary: 'Edit the opening balance of the given customer.' })
|
||||||
editOpeningBalance(
|
editOpeningBalance(
|
||||||
@Param('id') customerId: number,
|
@Param('id') customerId: number,
|
||||||
@Body() openingBalanceDTO: ICustomerOpeningBalanceEditDTO,
|
@Body() openingBalanceDTO: ICustomerOpeningBalanceEditDTO,
|
||||||
|
|||||||
@@ -15,8 +15,10 @@ import {
|
|||||||
} from './interfaces/Expenses.interface';
|
} from './interfaces/Expenses.interface';
|
||||||
import { PublicRoute } from '../Auth/Jwt.guard';
|
import { PublicRoute } from '../Auth/Jwt.guard';
|
||||||
import { IExpensesFilter } from './Expenses.types';
|
import { IExpensesFilter } from './Expenses.types';
|
||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('expenses')
|
@Controller('expenses')
|
||||||
|
@ApiTags('expenses')
|
||||||
@PublicRoute()
|
@PublicRoute()
|
||||||
export class ExpensesController {
|
export class ExpensesController {
|
||||||
constructor(private readonly expensesApplication: ExpensesApplication) {}
|
constructor(private readonly expensesApplication: ExpensesApplication) {}
|
||||||
@@ -26,6 +28,7 @@ export class ExpensesController {
|
|||||||
* @param {IExpenseCreateDTO} expenseDTO
|
* @param {IExpenseCreateDTO} expenseDTO
|
||||||
*/
|
*/
|
||||||
@Post()
|
@Post()
|
||||||
|
@ApiOperation({ summary: 'Create a new expense transaction.' })
|
||||||
public createExpense(@Body() expenseDTO: IExpenseCreateDTO) {
|
public createExpense(@Body() expenseDTO: IExpenseCreateDTO) {
|
||||||
return this.expensesApplication.createExpense(expenseDTO);
|
return this.expensesApplication.createExpense(expenseDTO);
|
||||||
}
|
}
|
||||||
@@ -36,6 +39,7 @@ export class ExpensesController {
|
|||||||
* @param {IExpenseEditDTO} expenseDTO
|
* @param {IExpenseEditDTO} expenseDTO
|
||||||
*/
|
*/
|
||||||
@Put(':id')
|
@Put(':id')
|
||||||
|
@ApiOperation({ summary: 'Edit the given expense transaction.' })
|
||||||
public editExpense(
|
public editExpense(
|
||||||
@Param('id') expenseId: number,
|
@Param('id') expenseId: number,
|
||||||
@Body() expenseDTO: IExpenseEditDTO,
|
@Body() expenseDTO: IExpenseEditDTO,
|
||||||
@@ -48,6 +52,7 @@ export class ExpensesController {
|
|||||||
* @param {number} expenseId
|
* @param {number} expenseId
|
||||||
*/
|
*/
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
|
@ApiOperation({ summary: 'Delete the given expense transaction.' })
|
||||||
public deleteExpense(@Param('id') expenseId: number) {
|
public deleteExpense(@Param('id') expenseId: number) {
|
||||||
return this.expensesApplication.deleteExpense(expenseId);
|
return this.expensesApplication.deleteExpense(expenseId);
|
||||||
}
|
}
|
||||||
@@ -57,6 +62,7 @@ export class ExpensesController {
|
|||||||
* @param {number} expenseId
|
* @param {number} expenseId
|
||||||
*/
|
*/
|
||||||
@Post(':id/publish')
|
@Post(':id/publish')
|
||||||
|
@ApiOperation({ summary: 'Publish the given expense transaction.' })
|
||||||
public publishExpense(@Param('id') expenseId: number) {
|
public publishExpense(@Param('id') expenseId: number) {
|
||||||
return this.expensesApplication.publishExpense(expenseId);
|
return this.expensesApplication.publishExpense(expenseId);
|
||||||
}
|
}
|
||||||
@@ -65,6 +71,7 @@ export class ExpensesController {
|
|||||||
* Get the expense transaction details.
|
* Get the expense transaction details.
|
||||||
*/
|
*/
|
||||||
@Get('')
|
@Get('')
|
||||||
|
@ApiOperation({ summary: 'Get the expense transaction details.' })
|
||||||
public getExpenses(@Query() filterDTO: IExpensesFilter) {
|
public getExpenses(@Query() filterDTO: IExpensesFilter) {
|
||||||
return this.expensesApplication.getExpenses(filterDTO);
|
return this.expensesApplication.getExpenses(filterDTO);
|
||||||
}
|
}
|
||||||
@@ -74,6 +81,7 @@ export class ExpensesController {
|
|||||||
* @param {number} expenseId
|
* @param {number} expenseId
|
||||||
*/
|
*/
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
|
@ApiOperation({ summary: 'Get the expense transaction details.' })
|
||||||
public getExpense(@Param('id') expenseId: number) {
|
public getExpense(@Param('id') expenseId: number) {
|
||||||
return this.expensesApplication.getExpense(expenseId);
|
return this.expensesApplication.getExpense(expenseId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,8 +15,10 @@ import {
|
|||||||
IItemCategoryOTD,
|
IItemCategoryOTD,
|
||||||
} from './ItemCategory.interfaces';
|
} from './ItemCategory.interfaces';
|
||||||
import { PublicRoute } from '../Auth/Jwt.guard';
|
import { PublicRoute } from '../Auth/Jwt.guard';
|
||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('item-categories')
|
@Controller('item-categories')
|
||||||
|
@ApiTags('item-categories')
|
||||||
@PublicRoute()
|
@PublicRoute()
|
||||||
export class ItemCategoryController {
|
export class ItemCategoryController {
|
||||||
constructor(
|
constructor(
|
||||||
@@ -24,6 +26,7 @@ export class ItemCategoryController {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
|
@ApiOperation({ summary: 'Create a new item category.' })
|
||||||
async createItemCategory(
|
async createItemCategory(
|
||||||
@Body('tenantId') tenantId: number,
|
@Body('tenantId') tenantId: number,
|
||||||
@Body() itemCategoryDTO: IItemCategoryOTD,
|
@Body() itemCategoryDTO: IItemCategoryOTD,
|
||||||
@@ -35,6 +38,7 @@ export class ItemCategoryController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
|
@ApiOperation({ summary: 'Retrieves the item categories.' })
|
||||||
async getItemCategories(
|
async getItemCategories(
|
||||||
@Query() filterDTO: IItemCategoriesFilter,
|
@Query() filterDTO: IItemCategoriesFilter,
|
||||||
): Promise<GetItemCategoriesResponse> {
|
): Promise<GetItemCategoriesResponse> {
|
||||||
@@ -42,6 +46,7 @@ export class ItemCategoryController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id')
|
@Put(':id')
|
||||||
|
@ApiOperation({ summary: 'Edit the given item category.' })
|
||||||
async editItemCategory(
|
async editItemCategory(
|
||||||
@Param('id') id: number,
|
@Param('id') id: number,
|
||||||
@Body() itemCategoryDTO: IItemCategoryOTD,
|
@Body() itemCategoryDTO: IItemCategoryOTD,
|
||||||
@@ -50,11 +55,13 @@ export class ItemCategoryController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the item category details.' })
|
||||||
async getItemCategory(@Param('id') id: number) {
|
async getItemCategory(@Param('id') id: number) {
|
||||||
return this.itemCategoryApplication.getItemCategory(id);
|
return this.itemCategoryApplication.getItemCategory(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
|
@ApiOperation({ summary: 'Delete the given item category.' })
|
||||||
async deleteItemCategory(@Param('id') id: number) {
|
async deleteItemCategory(@Param('id') id: number) {
|
||||||
return this.itemCategoryApplication.deleteItemCategory(id);
|
return this.itemCategoryApplication.deleteItemCategory(id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,11 @@ import { TenantController } from '../Tenancy/Tenant.controller';
|
|||||||
import { SubscriptionGuard } from '../Subscription/interceptors/Subscription.guard';
|
import { SubscriptionGuard } from '../Subscription/interceptors/Subscription.guard';
|
||||||
import { PublicRoute } from '../Auth/Jwt.guard';
|
import { PublicRoute } from '../Auth/Jwt.guard';
|
||||||
import { ItemsApplicationService } from './ItemsApplication.service';
|
import { ItemsApplicationService } from './ItemsApplication.service';
|
||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('/items')
|
@Controller('/items')
|
||||||
@UseGuards(SubscriptionGuard)
|
@UseGuards(SubscriptionGuard)
|
||||||
|
@ApiTags('items')
|
||||||
@PublicRoute()
|
@PublicRoute()
|
||||||
export class ItemsController extends TenantController {
|
export class ItemsController extends TenantController {
|
||||||
constructor(private readonly itemsApplication: ItemsApplicationService) {
|
constructor(private readonly itemsApplication: ItemsApplicationService) {
|
||||||
@@ -29,6 +31,7 @@ export class ItemsController extends TenantController {
|
|||||||
* @returns The updated item id.
|
* @returns The updated item id.
|
||||||
*/
|
*/
|
||||||
@Put(':id')
|
@Put(':id')
|
||||||
|
@ApiOperation({ summary: 'Edit the given item (product or service).' })
|
||||||
// @UsePipes(new ZodValidationPipe(createItemSchema))
|
// @UsePipes(new ZodValidationPipe(createItemSchema))
|
||||||
async editItem(
|
async editItem(
|
||||||
@Param('id') id: string,
|
@Param('id') id: string,
|
||||||
@@ -44,6 +47,7 @@ export class ItemsController extends TenantController {
|
|||||||
* @returns The created item id.
|
* @returns The created item id.
|
||||||
*/
|
*/
|
||||||
@Post()
|
@Post()
|
||||||
|
@ApiOperation({ summary: 'Create a new item (product or service).' })
|
||||||
// @UsePipes(new ZodValidationPipe(createItemSchema))
|
// @UsePipes(new ZodValidationPipe(createItemSchema))
|
||||||
async createItem(@Body() createItemDto: any): Promise<number> {
|
async createItem(@Body() createItemDto: any): Promise<number> {
|
||||||
return this.itemsApplication.createItem(createItemDto);
|
return this.itemsApplication.createItem(createItemDto);
|
||||||
@@ -54,6 +58,7 @@ export class ItemsController extends TenantController {
|
|||||||
* @param id - The item id.
|
* @param id - The item id.
|
||||||
*/
|
*/
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
|
@ApiOperation({ summary: 'Delete the given item (product or service).' })
|
||||||
async deleteItem(@Param('id') id: string): Promise<void> {
|
async deleteItem(@Param('id') id: string): Promise<void> {
|
||||||
const itemId = parseInt(id, 10);
|
const itemId = parseInt(id, 10);
|
||||||
return this.itemsApplication.deleteItem(itemId);
|
return this.itemsApplication.deleteItem(itemId);
|
||||||
@@ -64,6 +69,7 @@ export class ItemsController extends TenantController {
|
|||||||
* @param id - The item id.
|
* @param id - The item id.
|
||||||
*/
|
*/
|
||||||
@Patch(':id/inactivate')
|
@Patch(':id/inactivate')
|
||||||
|
@ApiOperation({ summary: 'Inactivate the given item (product or service).' })
|
||||||
async inactivateItem(@Param('id') id: string): Promise<void> {
|
async inactivateItem(@Param('id') id: string): Promise<void> {
|
||||||
console.log(id, 'XXXXXX');
|
console.log(id, 'XXXXXX');
|
||||||
|
|
||||||
@@ -76,6 +82,7 @@ export class ItemsController extends TenantController {
|
|||||||
* @param id - The item id.
|
* @param id - The item id.
|
||||||
*/
|
*/
|
||||||
@Patch(':id/activate')
|
@Patch(':id/activate')
|
||||||
|
@ApiOperation({ summary: 'Activate the given item (product or service).' })
|
||||||
async activateItem(@Param('id') id: string): Promise<void> {
|
async activateItem(@Param('id') id: string): Promise<void> {
|
||||||
const itemId = parseInt(id, 10);
|
const itemId = parseInt(id, 10);
|
||||||
return this.itemsApplication.activateItem(itemId);
|
return this.itemsApplication.activateItem(itemId);
|
||||||
@@ -86,6 +93,7 @@ export class ItemsController extends TenantController {
|
|||||||
* @param id - The item id.
|
* @param id - The item id.
|
||||||
*/
|
*/
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
|
@ApiOperation({ summary: 'Get the given item (product or service).' })
|
||||||
async getItem(@Param('id') id: string): Promise<any> {
|
async getItem(@Param('id') id: string): Promise<any> {
|
||||||
const itemId = parseInt(id, 10);
|
const itemId = parseInt(id, 10);
|
||||||
return this.itemsApplication.getItem(itemId);
|
return this.itemsApplication.getItem(itemId);
|
||||||
@@ -97,6 +105,7 @@ export class ItemsController extends TenantController {
|
|||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
@Get(':id/invoices')
|
@Get(':id/invoices')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the item associated invoices transactions.' })
|
||||||
async getItemInvoicesTransactions(@Param('id') id: string): Promise<any> {
|
async getItemInvoicesTransactions(@Param('id') id: string): Promise<any> {
|
||||||
const itemId = parseInt(id, 10);
|
const itemId = parseInt(id, 10);
|
||||||
return this.itemsApplication.getItemInvoicesTransactions(itemId);
|
return this.itemsApplication.getItemInvoicesTransactions(itemId);
|
||||||
@@ -108,6 +117,7 @@ export class ItemsController extends TenantController {
|
|||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
@Get(':id/bills')
|
@Get(':id/bills')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the item associated bills transactions.' })
|
||||||
async getItemBillTransactions(@Param('id') id: string): Promise<any> {
|
async getItemBillTransactions(@Param('id') id: string): Promise<any> {
|
||||||
const itemId = parseInt(id, 10);
|
const itemId = parseInt(id, 10);
|
||||||
return this.itemsApplication.getItemBillTransactions(itemId);
|
return this.itemsApplication.getItemBillTransactions(itemId);
|
||||||
@@ -119,6 +129,7 @@ export class ItemsController extends TenantController {
|
|||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
@Get(':id/estimates')
|
@Get(':id/estimates')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the item associated estimates transactions.' })
|
||||||
async getItemEstimatesTransactions(@Param('id') id: string): Promise<any> {
|
async getItemEstimatesTransactions(@Param('id') id: string): Promise<any> {
|
||||||
const itemId = parseInt(id, 10);
|
const itemId = parseInt(id, 10);
|
||||||
return this.itemsApplication.getItemEstimatesTransactions(itemId);
|
return this.itemsApplication.getItemEstimatesTransactions(itemId);
|
||||||
@@ -130,6 +141,7 @@ export class ItemsController extends TenantController {
|
|||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
@Get(':id/receipts')
|
@Get(':id/receipts')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the item associated receipts transactions.' })
|
||||||
async getItemReceiptTransactions(@Param('id') id: string): Promise<any> {
|
async getItemReceiptTransactions(@Param('id') id: string): Promise<any> {
|
||||||
const itemId = parseInt(id, 10);
|
const itemId = parseInt(id, 10);
|
||||||
return this.itemsApplication.getItemReceiptsTransactions(itemId);
|
return this.itemsApplication.getItemReceiptsTransactions(itemId);
|
||||||
|
|||||||
@@ -12,18 +12,22 @@ import {
|
|||||||
import { ManualJournalsApplication } from './ManualJournalsApplication.service';
|
import { ManualJournalsApplication } from './ManualJournalsApplication.service';
|
||||||
import { IManualJournalDTO } from './types/ManualJournals.types';
|
import { IManualJournalDTO } from './types/ManualJournals.types';
|
||||||
import { PublicRoute } from '../Auth/Jwt.guard';
|
import { PublicRoute } from '../Auth/Jwt.guard';
|
||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('manual-journals')
|
@Controller('manual-journals')
|
||||||
|
@ApiTags('manual-journals')
|
||||||
@PublicRoute()
|
@PublicRoute()
|
||||||
export class ManualJournalsController {
|
export class ManualJournalsController {
|
||||||
constructor(private manualJournalsApplication: ManualJournalsApplication) {}
|
constructor(private manualJournalsApplication: ManualJournalsApplication) {}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
|
@ApiOperation({ summary: 'Create a new manual journal.' })
|
||||||
public createManualJournal(@Body() manualJournalDTO: IManualJournalDTO) {
|
public createManualJournal(@Body() manualJournalDTO: IManualJournalDTO) {
|
||||||
return this.manualJournalsApplication.createManualJournal(manualJournalDTO);
|
return this.manualJournalsApplication.createManualJournal(manualJournalDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id')
|
@Put(':id')
|
||||||
|
@ApiOperation({ summary: 'Edit the given manual journal.' })
|
||||||
public editManualJournal(
|
public editManualJournal(
|
||||||
@Param('id') manualJournalId: number,
|
@Param('id') manualJournalId: number,
|
||||||
@Body() manualJournalDTO: IManualJournalDTO,
|
@Body() manualJournalDTO: IManualJournalDTO,
|
||||||
@@ -35,17 +39,20 @@ export class ManualJournalsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
|
@ApiOperation({ summary: 'Delete the given manual journal.' })
|
||||||
public deleteManualJournal(@Param('id') manualJournalId: number) {
|
public deleteManualJournal(@Param('id') manualJournalId: number) {
|
||||||
return this.manualJournalsApplication.deleteManualJournal(manualJournalId);
|
return this.manualJournalsApplication.deleteManualJournal(manualJournalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id/publish')
|
@Put(':id/publish')
|
||||||
|
@ApiOperation({ summary: 'Publish the given manual journal.' })
|
||||||
@HttpCode(HttpStatus.OK)
|
@HttpCode(HttpStatus.OK)
|
||||||
public publishManualJournal(@Param('id') manualJournalId: number) {
|
public publishManualJournal(@Param('id') manualJournalId: number) {
|
||||||
return this.manualJournalsApplication.publishManualJournal(manualJournalId);
|
return this.manualJournalsApplication.publishManualJournal(manualJournalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the manual journal details.' })
|
||||||
public getManualJournal(@Param('id') manualJournalId: number) {
|
public getManualJournal(@Param('id') manualJournalId: number) {
|
||||||
return this.manualJournalsApplication.getManualJournal(manualJournalId);
|
return this.manualJournalsApplication.getManualJournal(manualJournalId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,27 @@
|
|||||||
import { Body, Controller, Delete, Get, Param, Post, Put } from '@nestjs/common';
|
import {
|
||||||
|
Body,
|
||||||
|
Controller,
|
||||||
|
Delete,
|
||||||
|
Get,
|
||||||
|
Param,
|
||||||
|
Post,
|
||||||
|
Put,
|
||||||
|
} from '@nestjs/common';
|
||||||
import { PdfTemplateApplication } from './PdfTemplate.application';
|
import { PdfTemplateApplication } from './PdfTemplate.application';
|
||||||
import { ICreateInvoicePdfTemplateDTO, IEditPdfTemplateDTO } from './types';
|
import { ICreateInvoicePdfTemplateDTO, IEditPdfTemplateDTO } from './types';
|
||||||
import { PublicRoute } from '../Auth/Jwt.guard';
|
import { PublicRoute } from '../Auth/Jwt.guard';
|
||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('pdf-templates')
|
@Controller('pdf-templates')
|
||||||
|
@ApiTags('pdf-templates')
|
||||||
@PublicRoute()
|
@PublicRoute()
|
||||||
export class PdfTemplatesController {
|
export class PdfTemplatesController {
|
||||||
constructor(private readonly pdfTemplateApplication: PdfTemplateApplication) {}
|
constructor(
|
||||||
|
private readonly pdfTemplateApplication: PdfTemplateApplication,
|
||||||
|
) {}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
|
@ApiOperation({ summary: 'Create a new PDF template.' })
|
||||||
async createPdfTemplate(
|
async createPdfTemplate(
|
||||||
@Body('templateName') templateName: string,
|
@Body('templateName') templateName: string,
|
||||||
@Body('resource') resource: string,
|
@Body('resource') resource: string,
|
||||||
@@ -22,21 +35,25 @@ export class PdfTemplatesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
|
@ApiOperation({ summary: 'Delete the given PDF template.' })
|
||||||
async deletePdfTemplate(@Param('id') templateId: number) {
|
async deletePdfTemplate(@Param('id') templateId: number) {
|
||||||
return this.pdfTemplateApplication.deletePdfTemplate(templateId);
|
return this.pdfTemplateApplication.deletePdfTemplate(templateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the PDF template details.' })
|
||||||
async getPdfTemplate(@Param('id') templateId: number) {
|
async getPdfTemplate(@Param('id') templateId: number) {
|
||||||
return this.pdfTemplateApplication.getPdfTemplate(templateId);
|
return this.pdfTemplateApplication.getPdfTemplate(templateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
|
@ApiOperation({ summary: 'Retrieves the PDF templates.' })
|
||||||
async getPdfTemplates(@Body('resource') resource: string) {
|
async getPdfTemplates(@Body('resource') resource: string) {
|
||||||
return this.pdfTemplateApplication.getPdfTemplates(resource);
|
return this.pdfTemplateApplication.getPdfTemplates(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id')
|
@Put(':id')
|
||||||
|
@ApiOperation({ summary: 'Edit the given PDF template.' })
|
||||||
async editPdfTemplate(
|
async editPdfTemplate(
|
||||||
@Param('id') templateId: number,
|
@Param('id') templateId: number,
|
||||||
@Body() editDTO: IEditPdfTemplateDTO,
|
@Body() editDTO: IEditPdfTemplateDTO,
|
||||||
@@ -45,6 +62,7 @@ export class PdfTemplatesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id/assign-default')
|
@Put(':id/assign-default')
|
||||||
|
@ApiOperation({ summary: 'Assign the given PDF template as default.' })
|
||||||
async assignPdfTemplateAsDefault(@Param('id') templateId: number) {
|
async assignPdfTemplateAsDefault(@Param('id') templateId: number) {
|
||||||
return this.pdfTemplateApplication.assignPdfTemplateAsDefault(templateId);
|
return this.pdfTemplateApplication.assignPdfTemplateAsDefault(templateId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
import {
|
import {
|
||||||
Body,
|
Body,
|
||||||
Controller,
|
Controller,
|
||||||
@@ -19,6 +20,7 @@ import { SaleEstimate } from './models/SaleEstimate';
|
|||||||
import { PublicRoute } from '../Auth/Jwt.guard';
|
import { PublicRoute } from '../Auth/Jwt.guard';
|
||||||
|
|
||||||
@Controller('sale-estimates')
|
@Controller('sale-estimates')
|
||||||
|
@ApiTags('sale-estimates')
|
||||||
@PublicRoute()
|
@PublicRoute()
|
||||||
export class SaleEstimatesController {
|
export class SaleEstimatesController {
|
||||||
/**
|
/**
|
||||||
@@ -29,6 +31,7 @@ export class SaleEstimatesController {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
|
@ApiOperation({ summary: 'Create a new sale estimate.' })
|
||||||
public createSaleEstimate(
|
public createSaleEstimate(
|
||||||
@Body() estimateDTO: ISaleEstimateDTO,
|
@Body() estimateDTO: ISaleEstimateDTO,
|
||||||
): Promise<SaleEstimate> {
|
): Promise<SaleEstimate> {
|
||||||
@@ -36,6 +39,7 @@ export class SaleEstimatesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id')
|
@Put(':id')
|
||||||
|
@ApiOperation({ summary: 'Edit the given sale estimate.' })
|
||||||
public editSaleEstimate(
|
public editSaleEstimate(
|
||||||
@Param('id', ParseIntPipe) estimateId: number,
|
@Param('id', ParseIntPipe) estimateId: number,
|
||||||
@Body() estimateDTO: ISaleEstimateDTO,
|
@Body() estimateDTO: ISaleEstimateDTO,
|
||||||
@@ -47,6 +51,7 @@ export class SaleEstimatesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
|
@ApiOperation({ summary: 'Delete the given sale estimate.' })
|
||||||
public deleteSaleEstimate(
|
public deleteSaleEstimate(
|
||||||
@Param('id', ParseIntPipe) estimateId: number,
|
@Param('id', ParseIntPipe) estimateId: number,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
@@ -54,16 +59,19 @@ export class SaleEstimatesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get('state')
|
@Get('state')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the sale estimate state.' })
|
||||||
public getSaleEstimateState() {
|
public getSaleEstimateState() {
|
||||||
return this.saleEstimatesApplication.getSaleEstimateState();
|
return this.saleEstimatesApplication.getSaleEstimateState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
|
@ApiOperation({ summary: 'Retrieves the sale estimates.' })
|
||||||
public getSaleEstimates(@Query() filterDTO: ISalesEstimatesFilter) {
|
public getSaleEstimates(@Query() filterDTO: ISalesEstimatesFilter) {
|
||||||
return this.saleEstimatesApplication.getSaleEstimates(filterDTO);
|
return this.saleEstimatesApplication.getSaleEstimates(filterDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post(':id/deliver')
|
@Post(':id/deliver')
|
||||||
|
@ApiOperation({ summary: 'Deliver the given sale estimate.' })
|
||||||
public deliverSaleEstimate(
|
public deliverSaleEstimate(
|
||||||
@Param('id', ParseIntPipe) saleEstimateId: number,
|
@Param('id', ParseIntPipe) saleEstimateId: number,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
@@ -71,6 +79,7 @@ export class SaleEstimatesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id/approve')
|
@Put(':id/approve')
|
||||||
|
@ApiOperation({ summary: 'Approve the given sale estimate.' })
|
||||||
public approveSaleEstimate(
|
public approveSaleEstimate(
|
||||||
@Param('id', ParseIntPipe) saleEstimateId: number,
|
@Param('id', ParseIntPipe) saleEstimateId: number,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
@@ -78,6 +87,7 @@ export class SaleEstimatesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id/reject')
|
@Put(':id/reject')
|
||||||
|
@ApiOperation({ summary: 'Reject the given sale estimate.' })
|
||||||
public rejectSaleEstimate(
|
public rejectSaleEstimate(
|
||||||
@Param('id', ParseIntPipe) saleEstimateId: number,
|
@Param('id', ParseIntPipe) saleEstimateId: number,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
@@ -85,6 +95,7 @@ export class SaleEstimatesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Post(':id/notify-sms')
|
@Post(':id/notify-sms')
|
||||||
|
@ApiOperation({ summary: 'Notify the given sale estimate by SMS.' })
|
||||||
public notifySaleEstimateBySms(
|
public notifySaleEstimateBySms(
|
||||||
@Param('id', ParseIntPipe) saleEstimateId: number,
|
@Param('id', ParseIntPipe) saleEstimateId: number,
|
||||||
) {
|
) {
|
||||||
@@ -94,6 +105,7 @@ export class SaleEstimatesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id/sms-details')
|
@Get(':id/sms-details')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the sale estimate SMS details.' })
|
||||||
public getSaleEstimateSmsDetails(
|
public getSaleEstimateSmsDetails(
|
||||||
@Param('id', ParseIntPipe) saleEstimateId: number,
|
@Param('id', ParseIntPipe) saleEstimateId: number,
|
||||||
) {
|
) {
|
||||||
@@ -103,11 +115,13 @@ export class SaleEstimatesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id/pdf')
|
@Get(':id/pdf')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the sale estimate PDF.' })
|
||||||
public getSaleEstimatePdf(@Param('id', ParseIntPipe) saleEstimateId: number) {
|
public getSaleEstimatePdf(@Param('id', ParseIntPipe) saleEstimateId: number) {
|
||||||
return this.saleEstimatesApplication.getSaleEstimatePdf(saleEstimateId);
|
return this.saleEstimatesApplication.getSaleEstimatePdf(saleEstimateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post(':id/mail')
|
@Post(':id/mail')
|
||||||
|
@ApiOperation({ summary: 'Send the given sale estimate by mail.' })
|
||||||
public sendSaleEstimateMail(
|
public sendSaleEstimateMail(
|
||||||
@Param('id', ParseIntPipe) saleEstimateId: number,
|
@Param('id', ParseIntPipe) saleEstimateId: number,
|
||||||
@Body() mailOptions: SaleEstimateMailOptionsDTO,
|
@Body() mailOptions: SaleEstimateMailOptionsDTO,
|
||||||
@@ -119,6 +133,7 @@ export class SaleEstimatesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id/mail')
|
@Get(':id/mail')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the sale estimate mail details.' })
|
||||||
public getSaleEstimateMail(
|
public getSaleEstimateMail(
|
||||||
@Param('id', ParseIntPipe) saleEstimateId: number,
|
@Param('id', ParseIntPipe) saleEstimateId: number,
|
||||||
) {
|
) {
|
||||||
@@ -126,6 +141,7 @@ export class SaleEstimatesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the sale estimate details.' })
|
||||||
public getSaleEstimate(@Param('id', ParseIntPipe) estimateId: number) {
|
public getSaleEstimate(@Param('id', ParseIntPipe) estimateId: number) {
|
||||||
return this.saleEstimatesApplication.getSaleEstimate(estimateId);
|
return this.saleEstimatesApplication.getSaleEstimate(estimateId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,18 +18,22 @@ import {
|
|||||||
} from './SaleInvoice.types';
|
} from './SaleInvoice.types';
|
||||||
import { SaleInvoiceApplication } from './SaleInvoices.application';
|
import { SaleInvoiceApplication } from './SaleInvoices.application';
|
||||||
import { PublicRoute } from '../Auth/Jwt.guard';
|
import { PublicRoute } from '../Auth/Jwt.guard';
|
||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('sale-invoices')
|
@Controller('sale-invoices')
|
||||||
|
@ApiTags('sale-invoices')
|
||||||
@PublicRoute()
|
@PublicRoute()
|
||||||
export class SaleInvoicesController {
|
export class SaleInvoicesController {
|
||||||
constructor(private saleInvoiceApplication: SaleInvoiceApplication) {}
|
constructor(private saleInvoiceApplication: SaleInvoiceApplication) {}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
|
@ApiOperation({ summary: 'Create a new sale invoice.' })
|
||||||
createSaleInvoice(@Body() saleInvoiceDTO: ISaleInvoiceCreateDTO) {
|
createSaleInvoice(@Body() saleInvoiceDTO: ISaleInvoiceCreateDTO) {
|
||||||
return this.saleInvoiceApplication.createSaleInvoice(saleInvoiceDTO);
|
return this.saleInvoiceApplication.createSaleInvoice(saleInvoiceDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id')
|
@Put(':id')
|
||||||
|
@ApiOperation({ summary: 'Edit the given sale invoice.' })
|
||||||
editSaleInvoice(
|
editSaleInvoice(
|
||||||
@Param('id', ParseIntPipe) id: number,
|
@Param('id', ParseIntPipe) id: number,
|
||||||
@Body() saleInvoiceDTO: ISaleInvoiceEditDTO,
|
@Body() saleInvoiceDTO: ISaleInvoiceEditDTO,
|
||||||
@@ -38,6 +42,7 @@ export class SaleInvoicesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
|
@ApiOperation({ summary: 'Delete the given sale invoice.' })
|
||||||
deleteSaleInvoice(@Param('id', ParseIntPipe) id: number) {
|
deleteSaleInvoice(@Param('id', ParseIntPipe) id: number) {
|
||||||
return this.saleInvoiceApplication.deleteSaleInvoice(id);
|
return this.saleInvoiceApplication.deleteSaleInvoice(id);
|
||||||
}
|
}
|
||||||
@@ -48,16 +53,19 @@ export class SaleInvoicesController {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the sale invoice details.' })
|
||||||
getSaleInvoice(@Param('id', ParseIntPipe) id: number) {
|
getSaleInvoice(@Param('id', ParseIntPipe) id: number) {
|
||||||
return this.saleInvoiceApplication.getSaleInvoice(id);
|
return this.saleInvoiceApplication.getSaleInvoice(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id/state')
|
@Get(':id/state')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the sale invoice state.' })
|
||||||
getSaleInvoiceState() {
|
getSaleInvoiceState() {
|
||||||
return this.saleInvoiceApplication.getSaleInvoiceState();
|
return this.saleInvoiceApplication.getSaleInvoiceState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post(':id/deliver')
|
@Post(':id/deliver')
|
||||||
|
@ApiOperation({ summary: 'Deliver the given sale invoice.' })
|
||||||
@HttpCode(200)
|
@HttpCode(200)
|
||||||
deliverSaleInvoice(@Param('id', ParseIntPipe) id: number) {
|
deliverSaleInvoice(@Param('id', ParseIntPipe) id: number) {
|
||||||
return this.saleInvoiceApplication.deliverSaleInvoice(id);
|
return this.saleInvoiceApplication.deliverSaleInvoice(id);
|
||||||
@@ -69,6 +77,7 @@ export class SaleInvoicesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Post(':id/writeoff')
|
@Post(':id/writeoff')
|
||||||
|
@ApiOperation({ summary: 'Write off the given sale invoice.' })
|
||||||
@HttpCode(200)
|
@HttpCode(200)
|
||||||
writeOff(
|
writeOff(
|
||||||
@Param('id', ParseIntPipe) id: number,
|
@Param('id', ParseIntPipe) id: number,
|
||||||
@@ -78,27 +87,32 @@ export class SaleInvoicesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Post(':id/cancel-writeoff')
|
@Post(':id/cancel-writeoff')
|
||||||
|
@ApiOperation({ summary: 'Cancel the written off sale invoice.' })
|
||||||
@HttpCode(200)
|
@HttpCode(200)
|
||||||
cancelWrittenoff(@Param('id', ParseIntPipe) id: number) {
|
cancelWrittenoff(@Param('id', ParseIntPipe) id: number) {
|
||||||
return this.saleInvoiceApplication.cancelWrittenoff(id);
|
return this.saleInvoiceApplication.cancelWrittenoff(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id/payments')
|
@Get(':id/payments')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the sale invoice payments.' })
|
||||||
getInvoicePayments(@Param('id', ParseIntPipe) id: number) {
|
getInvoicePayments(@Param('id', ParseIntPipe) id: number) {
|
||||||
return this.saleInvoiceApplication.getInvoicePayments(id);
|
return this.saleInvoiceApplication.getInvoicePayments(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id/pdf')
|
@Get(':id/pdf')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the sale invoice PDF.' })
|
||||||
saleInvoicePdf(@Param('id', ParseIntPipe) id: number) {
|
saleInvoicePdf(@Param('id', ParseIntPipe) id: number) {
|
||||||
return this.saleInvoiceApplication.saleInvoicePdf(id);
|
return this.saleInvoiceApplication.saleInvoicePdf(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id/html')
|
@Get(':id/html')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the sale invoice HTML.' })
|
||||||
saleInvoiceHtml(@Param('id', ParseIntPipe) id: number) {
|
saleInvoiceHtml(@Param('id', ParseIntPipe) id: number) {
|
||||||
return this.saleInvoiceApplication.saleInvoiceHtml(id);
|
return this.saleInvoiceApplication.saleInvoiceHtml(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post(':id/notify-sms')
|
@Post(':id/notify-sms')
|
||||||
|
@ApiOperation({ summary: 'Notify the sale invoice by SMS.' })
|
||||||
notifySaleInvoiceBySms(
|
notifySaleInvoiceBySms(
|
||||||
@Param('id', ParseIntPipe) id: number,
|
@Param('id', ParseIntPipe) id: number,
|
||||||
@Body('type') notificationType: InvoiceNotificationType,
|
@Body('type') notificationType: InvoiceNotificationType,
|
||||||
@@ -121,6 +135,7 @@ export class SaleInvoicesController {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
@Get(':id/mail-reminder')
|
@Get(':id/mail-reminder')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the sale invoice mail reminder.' })
|
||||||
getSaleInvoiceMailReminder(@Param('id', ParseIntPipe) id: number) {
|
getSaleInvoiceMailReminder(@Param('id', ParseIntPipe) id: number) {
|
||||||
// return this.saleInvoiceApplication.getSaleInvoiceMailReminder(tenantId, id);
|
// return this.saleInvoiceApplication.getSaleInvoiceMailReminder(tenantId, id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,18 +11,22 @@ import {
|
|||||||
import { ISaleReceiptDTO } from './types/SaleReceipts.types';
|
import { ISaleReceiptDTO } from './types/SaleReceipts.types';
|
||||||
import { SaleReceiptApplication } from './SaleReceiptApplication.service';
|
import { SaleReceiptApplication } from './SaleReceiptApplication.service';
|
||||||
import { PublicRoute } from '../Auth/Jwt.guard';
|
import { PublicRoute } from '../Auth/Jwt.guard';
|
||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('sale-receipts')
|
@Controller('sale-receipts')
|
||||||
|
@ApiTags('sale-receipts')
|
||||||
@PublicRoute()
|
@PublicRoute()
|
||||||
export class SaleReceiptsController {
|
export class SaleReceiptsController {
|
||||||
constructor(private saleReceiptApplication: SaleReceiptApplication) {}
|
constructor(private saleReceiptApplication: SaleReceiptApplication) {}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
|
@ApiOperation({ summary: 'Create a new sale receipt.' })
|
||||||
createSaleReceipt(@Body() saleReceiptDTO: ISaleReceiptDTO) {
|
createSaleReceipt(@Body() saleReceiptDTO: ISaleReceiptDTO) {
|
||||||
return this.saleReceiptApplication.createSaleReceipt(saleReceiptDTO);
|
return this.saleReceiptApplication.createSaleReceipt(saleReceiptDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id')
|
@Put(':id')
|
||||||
|
@ApiOperation({ summary: 'Edit the given sale receipt.' })
|
||||||
editSaleReceipt(
|
editSaleReceipt(
|
||||||
@Param('id', ParseIntPipe) id: number,
|
@Param('id', ParseIntPipe) id: number,
|
||||||
@Body() saleReceiptDTO: ISaleReceiptDTO,
|
@Body() saleReceiptDTO: ISaleReceiptDTO,
|
||||||
@@ -31,26 +35,31 @@ export class SaleReceiptsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the sale receipt details.' })
|
||||||
getSaleReceipt(@Param('id', ParseIntPipe) id: number) {
|
getSaleReceipt(@Param('id', ParseIntPipe) id: number) {
|
||||||
return this.saleReceiptApplication.getSaleReceipt(id);
|
return this.saleReceiptApplication.getSaleReceipt(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
|
@ApiOperation({ summary: 'Delete the given sale receipt.' })
|
||||||
deleteSaleReceipt(@Param('id', ParseIntPipe) id: number) {
|
deleteSaleReceipt(@Param('id', ParseIntPipe) id: number) {
|
||||||
return this.saleReceiptApplication.deleteSaleReceipt(id);
|
return this.saleReceiptApplication.deleteSaleReceipt(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post(':id/close')
|
@Post(':id/close')
|
||||||
|
@ApiOperation({ summary: 'Close the given sale receipt.' })
|
||||||
closeSaleReceipt(@Param('id', ParseIntPipe) id: number) {
|
closeSaleReceipt(@Param('id', ParseIntPipe) id: number) {
|
||||||
return this.saleReceiptApplication.closeSaleReceipt(id);
|
return this.saleReceiptApplication.closeSaleReceipt(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id/pdf')
|
@Get(':id/pdf')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the sale receipt PDF.' })
|
||||||
getSaleReceiptPdf(@Param('id', ParseIntPipe) id: number) {
|
getSaleReceiptPdf(@Param('id', ParseIntPipe) id: number) {
|
||||||
return this.saleReceiptApplication.getSaleReceiptPdf(0, id);
|
return this.saleReceiptApplication.getSaleReceiptPdf(0, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('state')
|
@Get('state')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the sale receipt state.' })
|
||||||
getSaleReceiptState() {
|
getSaleReceiptState() {
|
||||||
return this.saleReceiptApplication.getSaleReceiptState();
|
return this.saleReceiptApplication.getSaleReceiptState();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ import { Body, Controller, Get, Post, Put } from '@nestjs/common';
|
|||||||
import { SettingsApplicationService } from './SettingsApplication.service';
|
import { SettingsApplicationService } from './SettingsApplication.service';
|
||||||
import { ISettingsDTO } from './Settings.types';
|
import { ISettingsDTO } from './Settings.types';
|
||||||
import { PublicRoute } from '../Auth/Jwt.guard';
|
import { PublicRoute } from '../Auth/Jwt.guard';
|
||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('settings')
|
@Controller('settings')
|
||||||
|
@ApiTags('settings')
|
||||||
@PublicRoute()
|
@PublicRoute()
|
||||||
export class SettingsController {
|
export class SettingsController {
|
||||||
constructor(
|
constructor(
|
||||||
@@ -11,11 +13,13 @@ export class SettingsController {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
@Put('')
|
@Put('')
|
||||||
|
@ApiOperation({ summary: 'Save the given settings.' })
|
||||||
async saveSettings(@Body() settingsDTO: ISettingsDTO) {
|
async saveSettings(@Body() settingsDTO: ISettingsDTO) {
|
||||||
return this.settingsApplicationService.saveSettings(settingsDTO);
|
return this.settingsApplicationService.saveSettings(settingsDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('')
|
@Get('')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the settings.' })
|
||||||
async getSettings() {
|
async getSettings() {
|
||||||
return this.settingsApplicationService.getSettings();
|
return this.settingsApplicationService.getSettings();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,18 +10,22 @@ import {
|
|||||||
import { TaxRatesApplication } from './TaxRate.application';
|
import { TaxRatesApplication } from './TaxRate.application';
|
||||||
import { ICreateTaxRateDTO, IEditTaxRateDTO } from './TaxRates.types';
|
import { ICreateTaxRateDTO, IEditTaxRateDTO } from './TaxRates.types';
|
||||||
import { PublicRoute } from '../Auth/Jwt.guard';
|
import { PublicRoute } from '../Auth/Jwt.guard';
|
||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('tax-rates')
|
@Controller('tax-rates')
|
||||||
|
@ApiTags('tax-rates')
|
||||||
@PublicRoute()
|
@PublicRoute()
|
||||||
export class TaxRatesController {
|
export class TaxRatesController {
|
||||||
constructor(private readonly taxRatesApplication: TaxRatesApplication) {}
|
constructor(private readonly taxRatesApplication: TaxRatesApplication) {}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
|
@ApiOperation({ summary: 'Create a new tax rate.' })
|
||||||
public createTaxRate(@Body() createTaxRateDTO: ICreateTaxRateDTO) {
|
public createTaxRate(@Body() createTaxRateDTO: ICreateTaxRateDTO) {
|
||||||
return this.taxRatesApplication.createTaxRate(createTaxRateDTO);
|
return this.taxRatesApplication.createTaxRate(createTaxRateDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id')
|
@Put(':id')
|
||||||
|
@ApiOperation({ summary: 'Edit the given tax rate.' })
|
||||||
public editTaxRate(
|
public editTaxRate(
|
||||||
@Param('id') taxRateId: number,
|
@Param('id') taxRateId: number,
|
||||||
@Body() editTaxRateDTO: IEditTaxRateDTO,
|
@Body() editTaxRateDTO: IEditTaxRateDTO,
|
||||||
@@ -30,26 +34,31 @@ export class TaxRatesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
|
@ApiOperation({ summary: 'Delete the given tax rate.' })
|
||||||
public deleteTaxRate(@Param('id') taxRateId: number) {
|
public deleteTaxRate(@Param('id') taxRateId: number) {
|
||||||
return this.taxRatesApplication.deleteTaxRate(taxRateId);
|
return this.taxRatesApplication.deleteTaxRate(taxRateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the tax rate details.' })
|
||||||
public getTaxRate(@Param('id') taxRateId: number) {
|
public getTaxRate(@Param('id') taxRateId: number) {
|
||||||
return this.taxRatesApplication.getTaxRate(taxRateId);
|
return this.taxRatesApplication.getTaxRate(taxRateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
|
@ApiOperation({ summary: 'Retrieves the tax rates.' })
|
||||||
public getTaxRates() {
|
public getTaxRates() {
|
||||||
return this.taxRatesApplication.getTaxRates();
|
return this.taxRatesApplication.getTaxRates();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id/activate')
|
@Put(':id/activate')
|
||||||
|
@ApiOperation({ summary: 'Activate the given tax rate.' })
|
||||||
public activateTaxRate(@Param('id') taxRateId: number) {
|
public activateTaxRate(@Param('id') taxRateId: number) {
|
||||||
return this.taxRatesApplication.activateTaxRate(taxRateId);
|
return this.taxRatesApplication.activateTaxRate(taxRateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id/inactivate')
|
@Put(':id/inactivate')
|
||||||
|
@ApiOperation({ summary: 'Inactivate the given tax rate.' })
|
||||||
public inactivateTaxRate(@Param('id') taxRateId: number) {
|
public inactivateTaxRate(@Param('id') taxRateId: number) {
|
||||||
return this.taxRatesApplication.inactivateTaxRate(taxRateId);
|
return this.taxRatesApplication.inactivateTaxRate(taxRateId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,8 +15,10 @@ import {
|
|||||||
IVendorCreditsQueryDTO,
|
IVendorCreditsQueryDTO,
|
||||||
} from './types/VendorCredit.types';
|
} from './types/VendorCredit.types';
|
||||||
import { PublicRoute } from '../Auth/Jwt.guard';
|
import { PublicRoute } from '../Auth/Jwt.guard';
|
||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('vendor-credits')
|
@Controller('vendor-credits')
|
||||||
|
@ApiTags('vendor-credits')
|
||||||
@PublicRoute()
|
@PublicRoute()
|
||||||
export class VendorCreditsController {
|
export class VendorCreditsController {
|
||||||
constructor(
|
constructor(
|
||||||
@@ -24,21 +26,25 @@ export class VendorCreditsController {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
|
@ApiOperation({ summary: 'Create a new vendor credit.' })
|
||||||
async createVendorCredit(@Body() dto: IVendorCreditCreateDTO) {
|
async createVendorCredit(@Body() dto: IVendorCreditCreateDTO) {
|
||||||
return this.vendorCreditsApplication.createVendorCredit(dto);
|
return this.vendorCreditsApplication.createVendorCredit(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id/open')
|
@Put(':id/open')
|
||||||
|
@ApiOperation({ summary: 'Open the given vendor credit.' })
|
||||||
async openVendorCredit(@Param('id') vendorCreditId: number) {
|
async openVendorCredit(@Param('id') vendorCreditId: number) {
|
||||||
return this.vendorCreditsApplication.openVendorCredit(vendorCreditId);
|
return this.vendorCreditsApplication.openVendorCredit(vendorCreditId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
|
@ApiOperation({ summary: 'Retrieves the vendor credits.' })
|
||||||
async getVendorCredits(@Query() filterDTO: IVendorCreditsQueryDTO) {
|
async getVendorCredits(@Query() filterDTO: IVendorCreditsQueryDTO) {
|
||||||
return this.vendorCreditsApplication.getVendorCredits(filterDTO);
|
return this.vendorCreditsApplication.getVendorCredits(filterDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id')
|
@Put(':id')
|
||||||
|
@ApiOperation({ summary: 'Edit the given vendor credit.' })
|
||||||
async editVendorCredit(
|
async editVendorCredit(
|
||||||
@Param('id') vendorCreditId: number,
|
@Param('id') vendorCreditId: number,
|
||||||
@Body() dto: IVendorCreditEditDTO,
|
@Body() dto: IVendorCreditEditDTO,
|
||||||
@@ -47,11 +53,13 @@ export class VendorCreditsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
|
@ApiOperation({ summary: 'Delete the given vendor credit.' })
|
||||||
async deleteVendorCredit(@Param('id') vendorCreditId: number) {
|
async deleteVendorCredit(@Param('id') vendorCreditId: number) {
|
||||||
return this.vendorCreditsApplication.deleteVendorCredit(vendorCreditId);
|
return this.vendorCreditsApplication.deleteVendorCredit(vendorCreditId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the vendor credit details.' })
|
||||||
async getVendorCredit(@Param('id') vendorCreditId: number) {
|
async getVendorCredit(@Param('id') vendorCreditId: number) {
|
||||||
return this.vendorCreditsApplication.getVendorCredit(vendorCreditId);
|
return this.vendorCreditsApplication.getVendorCredit(vendorCreditId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ import { VendorCreditsRefundApplication } from './VendorCreditsRefund.applicatio
|
|||||||
import { IRefundVendorCreditDTO } from './types/VendorCreditRefund.types';
|
import { IRefundVendorCreditDTO } from './types/VendorCreditRefund.types';
|
||||||
import { RefundVendorCredit } from './models/RefundVendorCredit';
|
import { RefundVendorCredit } from './models/RefundVendorCredit';
|
||||||
import { PublicRoute } from '../Auth/Jwt.guard';
|
import { PublicRoute } from '../Auth/Jwt.guard';
|
||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('vendor-credits')
|
@Controller('vendor-credits')
|
||||||
|
@ApiTags('vendor-credits-refunds')
|
||||||
@PublicRoute()
|
@PublicRoute()
|
||||||
export class VendorCreditsRefundController {
|
export class VendorCreditsRefundController {
|
||||||
constructor(
|
constructor(
|
||||||
@@ -20,6 +22,7 @@ export class VendorCreditsRefundController {
|
|||||||
* @returns {Promise<RefundVendorCredit>}
|
* @returns {Promise<RefundVendorCredit>}
|
||||||
*/
|
*/
|
||||||
@Post(':vendorCreditId/refunds')
|
@Post(':vendorCreditId/refunds')
|
||||||
|
@ApiOperation({ summary: 'Create a refund for the given vendor credit.' })
|
||||||
public async createRefundVendorCredit(
|
public async createRefundVendorCredit(
|
||||||
@Param('vendorCreditId') vendorCreditId: string,
|
@Param('vendorCreditId') vendorCreditId: string,
|
||||||
@Body() refundVendorCreditDTO: IRefundVendorCreditDTO,
|
@Body() refundVendorCreditDTO: IRefundVendorCreditDTO,
|
||||||
@@ -36,6 +39,7 @@ export class VendorCreditsRefundController {
|
|||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
@Delete('refunds/:refundCreditId')
|
@Delete('refunds/:refundCreditId')
|
||||||
|
@ApiOperation({ summary: 'Delete a refund for the given vendor credit.' })
|
||||||
public async deleteRefundVendorCredit(
|
public async deleteRefundVendorCredit(
|
||||||
@Param('refundCreditId') refundCreditId: string,
|
@Param('refundCreditId') refundCreditId: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
|||||||
@@ -16,38 +16,46 @@ import {
|
|||||||
IVendorsFilter,
|
IVendorsFilter,
|
||||||
} from './types/Vendors.types';
|
} from './types/Vendors.types';
|
||||||
import { PublicRoute } from '../Auth/Jwt.guard';
|
import { PublicRoute } from '../Auth/Jwt.guard';
|
||||||
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('vendors')
|
@Controller('vendors')
|
||||||
|
@ApiTags('vendors')
|
||||||
@PublicRoute()
|
@PublicRoute()
|
||||||
export class VendorsController {
|
export class VendorsController {
|
||||||
constructor(private vendorsApplication: VendorsApplication) {}
|
constructor(private vendorsApplication: VendorsApplication) {}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
|
@ApiOperation({ summary: 'Retrieves the vendors.' })
|
||||||
getVendors(@Query() filterDTO: IVendorsFilter) {
|
getVendors(@Query() filterDTO: IVendorsFilter) {
|
||||||
return this.vendorsApplication.getVendors(filterDTO);
|
return this.vendorsApplication.getVendors(filterDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
|
@ApiOperation({ summary: 'Retrieves the vendor details.' })
|
||||||
getVendor(@Param('id') vendorId: number) {
|
getVendor(@Param('id') vendorId: number) {
|
||||||
return this.vendorsApplication.getVendor(vendorId);
|
return this.vendorsApplication.getVendor(vendorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
|
@ApiOperation({ summary: 'Create a new vendor.' })
|
||||||
createVendor(@Body() vendorDTO: IVendorNewDTO) {
|
createVendor(@Body() vendorDTO: IVendorNewDTO) {
|
||||||
return this.vendorsApplication.createVendor(vendorDTO);
|
return this.vendorsApplication.createVendor(vendorDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id')
|
@Put(':id')
|
||||||
|
@ApiOperation({ summary: 'Edit the given vendor.' })
|
||||||
editVendor(@Param('id') vendorId: number, @Body() vendorDTO: IVendorEditDTO) {
|
editVendor(@Param('id') vendorId: number, @Body() vendorDTO: IVendorEditDTO) {
|
||||||
return this.vendorsApplication.editVendor(vendorId, vendorDTO);
|
return this.vendorsApplication.editVendor(vendorId, vendorDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
|
@ApiOperation({ summary: 'Delete the given vendor.' })
|
||||||
deleteVendor(@Param('id') vendorId: number) {
|
deleteVendor(@Param('id') vendorId: number) {
|
||||||
return this.vendorsApplication.deleteVendor(vendorId);
|
return this.vendorsApplication.deleteVendor(vendorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id/opening-balance')
|
@Put(':id/opening-balance')
|
||||||
|
@ApiOperation({ summary: 'Edit the given vendor opening balance.' })
|
||||||
editOpeningBalance(
|
editOpeningBalance(
|
||||||
@Param('id') vendorId: number,
|
@Param('id') vendorId: number,
|
||||||
@Body() openingBalanceDTO: IVendorOpeningBalanceEditDTO,
|
@Body() openingBalanceDTO: IVendorOpeningBalanceEditDTO,
|
||||||
|
|||||||
Reference in New Issue
Block a user