refactor: credit notes and vendor credits to Nestjs

This commit is contained in:
Ahmed Bouhuolia
2024-12-29 22:55:42 +02:00
parent caf235e2b5
commit 77bbf6828d
93 changed files with 2249 additions and 1634 deletions

View File

@@ -0,0 +1,48 @@
import { Body, Controller, Delete, Get, Param, Post } from '@nestjs/common';
import { VendorCreditApplyBillsApplicationService } from './VendorCreditApplyBillsApplication.service';
import { IVendorCreditApplyToInvoicesDTO } from './types/VendorCreditApplyBills.types';
@Controller('vendor-credits')
export class VendorCreditApplyBillsController {
constructor(
private readonly vendorCreditApplyBillsApplication: VendorCreditApplyBillsApplicationService,
) {}
@Get(':vendorCreditId/bills-to-apply')
async getVendorCreditToApplyBills(
@Param('vendorCreditId') vendorCreditId: number,
) {
return this.vendorCreditApplyBillsApplication.getVendorCreditToApplyBills(
vendorCreditId,
);
}
@Post(':vendorCreditId/apply-to-bills')
async applyVendorCreditToBills(
@Param('vendorCreditId') vendorCreditId: number,
@Body() applyCreditToBillsDTO: IVendorCreditApplyToInvoicesDTO,
) {
return this.vendorCreditApplyBillsApplication.applyVendorCreditToBills(
vendorCreditId,
applyCreditToBillsDTO,
);
}
@Delete('applied-bills/:vendorCreditAppliedBillId')
async deleteAppliedBillToVendorCredit(
@Param('vendorCreditAppliedBillId') vendorCreditAppliedBillId: number,
) {
return this.vendorCreditApplyBillsApplication.deleteAppliedBillToVendorCredit(
vendorCreditAppliedBillId,
);
}
@Get(':vendorCreditId/applied-bills')
async getAppliedBillsToVendorCredit(
@Param('vendorCreditId') vendorCreditId: number,
) {
return this.vendorCreditApplyBillsApplication.getAppliedBillsToVendorCredit(
vendorCreditId,
);
}
}