mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
refactor: financial reports to nestjs
This commit is contained in:
@@ -12,7 +12,7 @@ import {
|
||||
import { ISaleReceiptDTO } from './types/SaleReceipts.types';
|
||||
import { SaleReceiptApplication } from './SaleReceiptApplication.service';
|
||||
import { PublicRoute } from '../Auth/Jwt.guard';
|
||||
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||
import { ApiOperation, ApiParam, ApiTags } from '@nestjs/swagger';
|
||||
|
||||
@Controller('sale-receipts')
|
||||
@ApiTags('sale-receipts')
|
||||
@@ -29,6 +29,12 @@ export class SaleReceiptsController {
|
||||
@Put(':id/mail')
|
||||
@HttpCode(200)
|
||||
@ApiOperation({ summary: 'Send the sale receipt mail.' })
|
||||
@ApiParam({
|
||||
name: 'id',
|
||||
required: true,
|
||||
type: Number,
|
||||
description: 'The sale receipt id',
|
||||
})
|
||||
sendSaleReceiptMail(@Param('id', ParseIntPipe) id: number) {
|
||||
return this.saleReceiptApplication.getSaleReceiptMail(id);
|
||||
}
|
||||
@@ -36,12 +42,24 @@ export class SaleReceiptsController {
|
||||
@Get(':id/mail')
|
||||
@HttpCode(200)
|
||||
@ApiOperation({ summary: 'Retrieves the sale receipt mail.' })
|
||||
@ApiParam({
|
||||
name: 'id',
|
||||
required: true,
|
||||
type: Number,
|
||||
description: 'The sale receipt id',
|
||||
})
|
||||
getSaleReceiptMail(@Param('id', ParseIntPipe) id: number) {
|
||||
return this.saleReceiptApplication.getSaleReceiptMail(id);
|
||||
}
|
||||
|
||||
@Put(':id')
|
||||
@ApiOperation({ summary: 'Edit the given sale receipt.' })
|
||||
@ApiParam({
|
||||
name: 'id',
|
||||
required: true,
|
||||
type: Number,
|
||||
description: 'The sale receipt id',
|
||||
})
|
||||
editSaleReceipt(
|
||||
@Param('id', ParseIntPipe) id: number,
|
||||
@Body() saleReceiptDTO: ISaleReceiptDTO,
|
||||
@@ -51,24 +69,48 @@ export class SaleReceiptsController {
|
||||
|
||||
@Get(':id')
|
||||
@ApiOperation({ summary: 'Retrieves the sale receipt details.' })
|
||||
@ApiParam({
|
||||
name: 'id',
|
||||
required: true,
|
||||
type: Number,
|
||||
description: 'The sale receipt id',
|
||||
})
|
||||
getSaleReceipt(@Param('id', ParseIntPipe) id: number) {
|
||||
return this.saleReceiptApplication.getSaleReceipt(id);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
@ApiOperation({ summary: 'Delete the given sale receipt.' })
|
||||
@ApiParam({
|
||||
name: 'id',
|
||||
required: true,
|
||||
type: Number,
|
||||
description: 'The sale receipt id',
|
||||
})
|
||||
deleteSaleReceipt(@Param('id', ParseIntPipe) id: number) {
|
||||
return this.saleReceiptApplication.deleteSaleReceipt(id);
|
||||
}
|
||||
|
||||
@Post(':id/close')
|
||||
@ApiOperation({ summary: 'Close the given sale receipt.' })
|
||||
@ApiParam({
|
||||
name: 'id',
|
||||
required: true,
|
||||
type: Number,
|
||||
description: 'The sale receipt id',
|
||||
})
|
||||
closeSaleReceipt(@Param('id', ParseIntPipe) id: number) {
|
||||
return this.saleReceiptApplication.closeSaleReceipt(id);
|
||||
}
|
||||
|
||||
@Get(':id/pdf')
|
||||
@ApiOperation({ summary: 'Retrieves the sale receipt PDF.' })
|
||||
@ApiParam({
|
||||
name: 'id',
|
||||
required: true,
|
||||
type: Number,
|
||||
description: 'The sale receipt id',
|
||||
})
|
||||
getSaleReceiptPdf(@Param('id', ParseIntPipe) id: number) {
|
||||
return this.saleReceiptApplication.getSaleReceiptPdf(0, id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user