fix(api): align ids type with value

This commit is contained in:
yassinedorbozgithub 2025-02-26 16:31:41 +01:00
parent b3a5bc2ac3
commit 67b1b7d7ff
7 changed files with 20 additions and 20 deletions

View File

@ -325,8 +325,8 @@ export class BlockController extends BaseController<
@CsrfCheck(true)
@Delete('')
@HttpCode(204)
async deleteMany(@Body('ids') ids: string[]): Promise<DeleteResult> {
if (!ids || ids.length === 0) {
async deleteMany(@Body('ids') ids?: string[]): Promise<DeleteResult> {
if (!ids?.length) {
throw new BadRequestException('No IDs provided for deletion.');
}
const deleteResult = await this.blockService.deleteMany({

View File

@ -1,5 +1,5 @@
/*
* Copyright © 2024 Hexastack. All rights reserved.
* Copyright © 2025 Hexastack. All rights reserved.
*
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
* 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.
@ -142,8 +142,8 @@ export class CategoryController extends BaseController<Category> {
@CsrfCheck(true)
@Delete('')
@HttpCode(204)
async deleteMany(@Body('ids') ids: string[]): Promise<DeleteResult> {
if (!ids || ids.length === 0) {
async deleteMany(@Body('ids') ids?: string[]): Promise<DeleteResult> {
if (!ids?.length) {
throw new BadRequestException('No IDs provided for deletion.');
}
const deleteResult = await this.categoryService.deleteMany({

View File

@ -1,5 +1,5 @@
/*
* Copyright © 2024 Hexastack. All rights reserved.
* Copyright © 2025 Hexastack. All rights reserved.
*
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
* 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.
@ -149,8 +149,8 @@ export class ContextVarController extends BaseController<ContextVar> {
@CsrfCheck(true)
@Delete('')
@HttpCode(204)
async deleteMany(@Body('ids') ids: string[]): Promise<DeleteResult> {
if (!ids || ids.length === 0) {
async deleteMany(@Body('ids') ids?: string[]): Promise<DeleteResult> {
if (!ids?.length) {
throw new BadRequestException('No IDs provided for deletion.');
}
const deleteResult = await this.contextVarService.deleteMany({

View File

@ -1,5 +1,5 @@
/*
* Copyright © 2024 Hexastack. All rights reserved.
* Copyright © 2025 Hexastack. All rights reserved.
*
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
* 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.
@ -136,8 +136,8 @@ export class LabelController extends BaseController<
@CsrfCheck(true)
@Delete('')
@HttpCode(204)
async deleteMany(@Body('ids') ids: string[]): Promise<DeleteResult> {
if (!ids || ids.length === 0) {
async deleteMany(@Body('ids') ids?: string[]): Promise<DeleteResult> {
if (!ids?.length) {
throw new BadRequestException('No IDs provided for deletion.');
}
const deleteResult = await this.labelService.deleteMany({

View File

@ -1,5 +1,5 @@
/*
* Copyright © 2024 Hexastack. All rights reserved.
* Copyright © 2025 Hexastack. All rights reserved.
*
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
* 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.
@ -212,8 +212,8 @@ export class NlpEntityController extends BaseController<
@CsrfCheck(true)
@Delete('')
@HttpCode(204)
async deleteMany(@Body('ids') ids: string[]): Promise<DeleteResult> {
if (!ids || ids.length === 0) {
async deleteMany(@Body('ids') ids?: string[]): Promise<DeleteResult> {
if (!ids?.length) {
throw new BadRequestException('No IDs provided for deletion.');
}
const deleteResult = await this.nlpEntityService.deleteMany({

View File

@ -1,5 +1,5 @@
/*
* Copyright © 2024 Hexastack. All rights reserved.
* Copyright © 2025 Hexastack. All rights reserved.
*
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
* 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.
@ -347,8 +347,8 @@ export class NlpSampleController extends BaseController<
@CsrfCheck(true)
@Delete('')
@HttpCode(204)
async deleteMany(@Body('ids') ids: string[]): Promise<DeleteResult> {
if (!ids || ids.length === 0) {
async deleteMany(@Body('ids') ids?: string[]): Promise<DeleteResult> {
if (!ids?.length) {
throw new BadRequestException('No IDs provided for deletion.');
}
const deleteResult = await this.nlpSampleService.deleteMany({

View File

@ -1,5 +1,5 @@
/*
* Copyright © 2024 Hexastack. All rights reserved.
* Copyright © 2025 Hexastack. All rights reserved.
*
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
* 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.
@ -200,8 +200,8 @@ export class NlpValueController extends BaseController<
@CsrfCheck(true)
@Delete('')
@HttpCode(204)
async deleteMany(@Body('ids') ids: string[]): Promise<DeleteResult> {
if (!ids || ids.length === 0) {
async deleteMany(@Body('ids') ids?: string[]): Promise<DeleteResult> {
if (!ids?.length) {
throw new BadRequestException('No IDs provided for deletion.');
}
const deleteResult = await this.nlpValueService.deleteMany({