mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
feat(nestjs): migrate to NestJS
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||
import { Body, Controller, Delete, Param, Post } from '@nestjs/common';
|
||||
import { ICreditNoteRefundDTO } from '../CreditNotes/types/CreditNotes.types';
|
||||
import { CreditNotesRefundsApplication } from './CreditNotesRefundsApplication.service';
|
||||
import { RefundCreditNote } from './models/RefundCreditNote';
|
||||
import { CreditNoteRefundDto } from './dto/CreditNoteRefund.dto';
|
||||
|
||||
@Controller('credit-notes')
|
||||
@ApiTags('credit-notes-refunds')
|
||||
export class CreditNoteRefundsController {
|
||||
constructor(
|
||||
private readonly creditNotesRefundsApplication: CreditNotesRefundsApplication,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Create a refund credit note.
|
||||
* @param {number} creditNoteId - The credit note ID.
|
||||
* @param {ICreditNoteRefundDTO} creditNoteDTO - The credit note DTO.
|
||||
* @returns {Promise<RefundCreditNote>}
|
||||
*/
|
||||
@Post(':creditNoteId/refunds')
|
||||
@ApiOperation({ summary: 'Create a refund for the given credit note.' })
|
||||
createRefundCreditNote(
|
||||
@Param('creditNoteId') creditNoteId: number,
|
||||
@Body() creditNoteDTO: CreditNoteRefundDto,
|
||||
): Promise<RefundCreditNote> {
|
||||
return this.creditNotesRefundsApplication.createRefundCreditNote(
|
||||
creditNoteId,
|
||||
creditNoteDTO,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a refund credit note.
|
||||
* @param {number} refundCreditId - The refund credit ID.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Delete('refunds/:refundCreditId')
|
||||
@ApiOperation({ summary: 'Delete a refund for the given credit note.' })
|
||||
deleteRefundCreditNote(
|
||||
@Param('refundCreditId') refundCreditId: number,
|
||||
): Promise<void> {
|
||||
return this.creditNotesRefundsApplication.deleteRefundCreditNote(
|
||||
refundCreditId,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user