Skip to content

Commit 7acf637

Browse files
authored
Merge pull request Hexastack#802 from Hexastack/801-issue---deletemany-align-ids-type-with-value
fix(api): align deleteMany ids type with value
2 parents 4399cc0 + 67b1b7d commit 7acf637

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

api/src/chat/controllers/block.controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ export class BlockController extends BaseController<
325325
@CsrfCheck(true)
326326
@Delete('')
327327
@HttpCode(204)
328-
async deleteMany(@Body('ids') ids: string[]): Promise<DeleteResult> {
329-
if (!ids || ids.length === 0) {
328+
async deleteMany(@Body('ids') ids?: string[]): Promise<DeleteResult> {
329+
if (!ids?.length) {
330330
throw new BadRequestException('No IDs provided for deletion.');
331331
}
332332
const deleteResult = await this.blockService.deleteMany({

api/src/chat/controllers/category.controller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright © 2024 Hexastack. All rights reserved.
2+
* Copyright © 2025 Hexastack. All rights reserved.
33
*
44
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
55
* 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> {
142142
@CsrfCheck(true)
143143
@Delete('')
144144
@HttpCode(204)
145-
async deleteMany(@Body('ids') ids: string[]): Promise<DeleteResult> {
146-
if (!ids || ids.length === 0) {
145+
async deleteMany(@Body('ids') ids?: string[]): Promise<DeleteResult> {
146+
if (!ids?.length) {
147147
throw new BadRequestException('No IDs provided for deletion.');
148148
}
149149
const deleteResult = await this.categoryService.deleteMany({

api/src/chat/controllers/context-var.controller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright © 2024 Hexastack. All rights reserved.
2+
* Copyright © 2025 Hexastack. All rights reserved.
33
*
44
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
55
* 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> {
149149
@CsrfCheck(true)
150150
@Delete('')
151151
@HttpCode(204)
152-
async deleteMany(@Body('ids') ids: string[]): Promise<DeleteResult> {
153-
if (!ids || ids.length === 0) {
152+
async deleteMany(@Body('ids') ids?: string[]): Promise<DeleteResult> {
153+
if (!ids?.length) {
154154
throw new BadRequestException('No IDs provided for deletion.');
155155
}
156156
const deleteResult = await this.contextVarService.deleteMany({

api/src/chat/controllers/label.controller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright © 2024 Hexastack. All rights reserved.
2+
* Copyright © 2025 Hexastack. All rights reserved.
33
*
44
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
55
* 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<
136136
@CsrfCheck(true)
137137
@Delete('')
138138
@HttpCode(204)
139-
async deleteMany(@Body('ids') ids: string[]): Promise<DeleteResult> {
140-
if (!ids || ids.length === 0) {
139+
async deleteMany(@Body('ids') ids?: string[]): Promise<DeleteResult> {
140+
if (!ids?.length) {
141141
throw new BadRequestException('No IDs provided for deletion.');
142142
}
143143
const deleteResult = await this.labelService.deleteMany({

api/src/nlp/controllers/nlp-entity.controller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright © 2024 Hexastack. All rights reserved.
2+
* Copyright © 2025 Hexastack. All rights reserved.
33
*
44
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
55
* 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<
212212
@CsrfCheck(true)
213213
@Delete('')
214214
@HttpCode(204)
215-
async deleteMany(@Body('ids') ids: string[]): Promise<DeleteResult> {
216-
if (!ids || ids.length === 0) {
215+
async deleteMany(@Body('ids') ids?: string[]): Promise<DeleteResult> {
216+
if (!ids?.length) {
217217
throw new BadRequestException('No IDs provided for deletion.');
218218
}
219219
const deleteResult = await this.nlpEntityService.deleteMany({

api/src/nlp/controllers/nlp-sample.controller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright © 2024 Hexastack. All rights reserved.
2+
* Copyright © 2025 Hexastack. All rights reserved.
33
*
44
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
55
* 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<
347347
@CsrfCheck(true)
348348
@Delete('')
349349
@HttpCode(204)
350-
async deleteMany(@Body('ids') ids: string[]): Promise<DeleteResult> {
351-
if (!ids || ids.length === 0) {
350+
async deleteMany(@Body('ids') ids?: string[]): Promise<DeleteResult> {
351+
if (!ids?.length) {
352352
throw new BadRequestException('No IDs provided for deletion.');
353353
}
354354
const deleteResult = await this.nlpSampleService.deleteMany({

api/src/nlp/controllers/nlp-value.controller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright © 2024 Hexastack. All rights reserved.
2+
* Copyright © 2025 Hexastack. All rights reserved.
33
*
44
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
55
* 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<
200200
@CsrfCheck(true)
201201
@Delete('')
202202
@HttpCode(204)
203-
async deleteMany(@Body('ids') ids: string[]): Promise<DeleteResult> {
204-
if (!ids || ids.length === 0) {
203+
async deleteMany(@Body('ids') ids?: string[]): Promise<DeleteResult> {
204+
if (!ids?.length) {
205205
throw new BadRequestException('No IDs provided for deletion.');
206206
}
207207
const deleteResult = await this.nlpValueService.deleteMany({

0 commit comments

Comments
 (0)