feat(nestjs): migrate to NestJS

This commit is contained in:
Ahmed Bouhuolia
2025-04-07 11:51:24 +02:00
parent f068218a16
commit 55fcc908ef
3779 changed files with 631 additions and 195332 deletions

View File

@@ -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,
);
}
}