mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
refactor(nestjs): wip dtos validation schema
This commit is contained in:
@@ -15,11 +15,15 @@ import {
|
||||
EditBillPaymentDto,
|
||||
} from './dtos/BillPayment.dto';
|
||||
import { GetBillPaymentsFilterDto } from './dtos/GetBillPaymentsFilter.dto';
|
||||
import { BillPaymentsPages } from './commands/BillPaymentsPages.service';
|
||||
|
||||
@Controller('bill-payments')
|
||||
@ApiTags('bill-payments')
|
||||
export class BillPaymentsController {
|
||||
constructor(private billPaymentsApplication: BillPaymentsApplication) {}
|
||||
constructor(
|
||||
private billPaymentsApplication: BillPaymentsApplication,
|
||||
private billPaymentsPagesService: BillPaymentsPages,
|
||||
) {}
|
||||
|
||||
@Post()
|
||||
@ApiOperation({ summary: 'Create a new bill payment.' })
|
||||
@@ -59,6 +63,24 @@ export class BillPaymentsController {
|
||||
);
|
||||
}
|
||||
|
||||
@Get('/new-page/entries')
|
||||
@ApiOperation({
|
||||
summary:
|
||||
'Retrieves the payable entries of the new page once vendor be selected.',
|
||||
})
|
||||
@ApiParam({
|
||||
name: 'vendorId',
|
||||
required: true,
|
||||
type: Number,
|
||||
description: 'The vendor id',
|
||||
})
|
||||
async getBillPaymentNewPageEntries(@Query('vendorId') vendorId: number) {
|
||||
const entries =
|
||||
await this.billPaymentsPagesService.getNewPageEntries(vendorId);
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
@Get(':billPaymentId/bills')
|
||||
@ApiOperation({ summary: 'Retrieves the bills of the given bill payment.' })
|
||||
@ApiParam({
|
||||
@@ -71,6 +93,25 @@ export class BillPaymentsController {
|
||||
return this.billPaymentsApplication.getPaymentBills(Number(billPaymentId));
|
||||
}
|
||||
|
||||
@Get('/:billPaymentId/edit-page')
|
||||
@ApiOperation({
|
||||
summary: 'Retrieves the edit page of the given bill payment.',
|
||||
})
|
||||
@ApiParam({
|
||||
name: 'billPaymentId',
|
||||
required: true,
|
||||
type: Number,
|
||||
description: 'The bill payment id',
|
||||
})
|
||||
public async getBillPaymentEditPage(
|
||||
@Param('billPaymentId') billPaymentId: number,
|
||||
) {
|
||||
const billPaymentsWithEditEntries =
|
||||
await this.billPaymentsPagesService.getBillPaymentEditPage(billPaymentId);
|
||||
|
||||
return billPaymentsWithEditEntries;
|
||||
}
|
||||
|
||||
@Get(':billPaymentId')
|
||||
@ApiOperation({ summary: 'Retrieves the bill payment details.' })
|
||||
@ApiParam({
|
||||
@@ -83,8 +124,14 @@ export class BillPaymentsController {
|
||||
return this.billPaymentsApplication.getBillPayment(Number(billPaymentId));
|
||||
}
|
||||
|
||||
@Get('')
|
||||
@Get()
|
||||
@ApiOperation({ summary: 'Retrieves the bill payments list.' })
|
||||
@ApiParam({
|
||||
name: 'filterDTO',
|
||||
required: true,
|
||||
type: GetBillPaymentsFilterDto,
|
||||
description: 'The bill payments filter dto',
|
||||
})
|
||||
public getBillPayments(@Query() filterDTO: GetBillPaymentsFilterDto) {
|
||||
return this.billPaymentsApplication.getBillPayments(filterDTO);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user