mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
55 lines
1.2 KiB
TypeScript
55 lines
1.2 KiB
TypeScript
import {
|
|
Controller,
|
|
Post,
|
|
Body,
|
|
Put,
|
|
Param,
|
|
Delete,
|
|
Get,
|
|
Query,
|
|
} from '@nestjs/common';
|
|
import { BillsApplication } from './Bills.application';
|
|
import { IBillDTO, IBillEditDTO } from './Bills.types';
|
|
import { PublicRoute } from '../Auth/Jwt.guard';
|
|
|
|
@Controller('bills')
|
|
@PublicRoute()
|
|
export class BillsController {
|
|
constructor(private billsApplication: BillsApplication) {}
|
|
|
|
@Post()
|
|
createBill(@Body() billDTO: IBillDTO) {
|
|
return this.billsApplication.createBill(billDTO);
|
|
}
|
|
|
|
@Put(':id')
|
|
editBill(@Param('id') billId: number, @Body() billDTO: IBillEditDTO) {
|
|
return this.billsApplication.editBill(billId, billDTO);
|
|
}
|
|
|
|
@Delete(':id')
|
|
deleteBill(@Param('id') billId: number) {
|
|
return this.billsApplication.deleteBill(billId);
|
|
}
|
|
|
|
@Get()
|
|
getBills(@Query() filterDTO: IBillsFilter) {
|
|
return this.billsApplication.getBills(filterDTO);
|
|
}
|
|
|
|
@Get(':id')
|
|
getBill(@Param('id') billId: number) {
|
|
return this.billsApplication.getBill(billId);
|
|
}
|
|
|
|
@Post(':id/open')
|
|
openBill(@Param('id') billId: number) {
|
|
return this.billsApplication.openBill(billId);
|
|
}
|
|
|
|
@Get('due')
|
|
getDueBills(@Body('vendorId') vendorId?: number) {
|
|
return this.billsApplication.getDueBills(vendorId);
|
|
}
|
|
}
|