This commit is contained in:
Ahmed Bouhuolia
2025-11-19 22:59:21 +02:00
parent 17bcc14231
commit 2b384b2f6f
31 changed files with 405 additions and 62 deletions

View File

@@ -3,6 +3,7 @@ import {
ApiOperation,
ApiResponse,
ApiParam,
ApiQuery,
ApiExtraModels,
getSchemaPath,
} from '@nestjs/swagger';
@@ -11,7 +12,9 @@ import {
Controller,
Delete,
Get,
DefaultValuePipe,
Param,
ParseBoolPipe,
Post,
Put,
Query,
@@ -37,7 +40,7 @@ export class CreditNotesController {
/**
* @param {CreditNoteApplication} creditNoteApplication - The credit note application service.
*/
constructor(private creditNoteApplication: CreditNoteApplication) {}
constructor(private creditNoteApplication: CreditNoteApplication) { }
@Post()
@ApiOperation({ summary: 'Create a new credit note' })
@@ -140,13 +143,25 @@ export class CreditNotesController {
@Post('bulk-delete')
@ApiOperation({ summary: 'Deletes multiple credit notes.' })
@ApiQuery({
name: 'skip_undeletable',
required: false,
type: Boolean,
description:
'When true, undeletable credit notes will be skipped and only deletable ones will be removed.',
})
@ApiResponse({
status: 200,
description: 'Credit notes deleted successfully',
})
bulkDeleteCreditNotes(@Body() bulkDeleteDto: BulkDeleteDto): Promise<void> {
bulkDeleteCreditNotes(
@Body() bulkDeleteDto: BulkDeleteDto,
@Query('skip_undeletable', new DefaultValuePipe(false), ParseBoolPipe)
skipUndeletable: boolean,
): Promise<void> {
return this.creditNoteApplication.bulkDeleteCreditNotes(
bulkDeleteDto.ids,
{ skipUndeletable },
);
}