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

@@ -2,11 +2,13 @@ import { Response } from 'express';
import {
Body,
Controller,
DefaultValuePipe,
Delete,
Get,
Headers,
HttpCode,
Param,
ParseBoolPipe,
ParseIntPipe,
Post,
Put,
@@ -78,13 +80,25 @@ export class SaleInvoicesController {
@Post('bulk-delete')
@ApiOperation({ summary: 'Deletes multiple sale invoices.' })
@ApiQuery({
name: 'skip_undeletable',
required: false,
type: Boolean,
description:
'When true, undeletable invoices will be skipped and only deletable ones will be removed.',
})
@ApiResponse({
status: 200,
description: 'Sale invoices deleted successfully',
})
bulkDeleteSaleInvoices(@Body() bulkDeleteDto: BulkDeleteDto): Promise<void> {
bulkDeleteSaleInvoices(
@Body() bulkDeleteDto: BulkDeleteDto,
@Query('skip_undeletable', new DefaultValuePipe(false), ParseBoolPipe)
skipUndeletable: boolean,
): Promise<void> {
return this.saleInvoiceApplication.bulkDeleteSaleInvoices(
bulkDeleteDto.ids,
{ skipUndeletable },
);
}