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

@@ -6,6 +6,8 @@ import {
Headers,
HttpCode,
Param,
ParseBoolPipe,
DefaultValuePipe,
ParseIntPipe,
Post,
Put,
@@ -17,6 +19,7 @@ import {
ApiExtraModels,
ApiOperation,
ApiParam,
ApiQuery,
ApiResponse,
ApiTags,
getSchemaPath,
@@ -70,13 +73,25 @@ export class SaleReceiptsController {
@Post('bulk-delete')
@ApiOperation({ summary: 'Deletes multiple sale receipts.' })
@ApiQuery({
name: 'skip_undeletable',
required: false,
type: Boolean,
description:
'When true, undeletable receipts will be skipped and only deletable ones will be removed.',
})
@ApiResponse({
status: 200,
description: 'Sale receipts deleted successfully',
})
bulkDeleteSaleReceipts(@Body() bulkDeleteDto: BulkDeleteDto): Promise<void> {
bulkDeleteSaleReceipts(
@Body() bulkDeleteDto: BulkDeleteDto,
@Query('skip_undeletable', new DefaultValuePipe(false), ParseBoolPipe)
skipUndeletable: boolean,
): Promise<void> {
return this.saleReceiptApplication.bulkDeleteSaleReceipts(
bulkDeleteDto.ids,
{ skipUndeletable },
);
}