From dad6b557894dfd66541abc73528b2e8681d3be63 Mon Sep 17 00:00:00 2001 From: yassinedorbozgithub Date: Tue, 17 Jun 2025 15:10:36 +0100 Subject: [PATCH] fix(api): add JSDoc --- api/src/nlp/services/nlp.service.ts | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/api/src/nlp/services/nlp.service.ts b/api/src/nlp/services/nlp.service.ts index 3fa85947..e1e56949 100644 --- a/api/src/nlp/services/nlp.service.ts +++ b/api/src/nlp/services/nlp.service.ts @@ -105,12 +105,18 @@ export class NlpService { } /** - * Handles the event triggered when an NLP entity is deleted. Synchronizes the deletion with the external NLP provider. + * Before deleting a `nlpEntity`, this method deletes the related `nlpValue` and `nlpSampleEntity`. Synchronizes the deletion with the external NLP provider * - * @param entity - The NLP entity to be deleted. + * @param _query - The Mongoose query object used for deletion. + * @param criteria - The filter criteria for finding the nlpEntities to be deleted. + * + * @returns {Promise} A promise that resolves once the event is emitted. */ @OnEvent('hook:nlpEntity:preDelete') - async handleEntityDelete(_query: unknown, criteria: TFilterQuery) { + async handleEntityDelete( + _query: unknown, + criteria: TFilterQuery, + ): Promise { if (criteria._id) { await this.nlpValueService.deleteMany({ entity: criteria._id }); await this.nlpSampleEntityService.deleteMany({ entity: criteria._id }); @@ -181,12 +187,18 @@ export class NlpService { } /** - * Handles the event triggered when an NLP value is deleted. Synchronizes the deletion with the external NLP provider. + * Before deleting a `nlpValue`, this method deletes the related `nlpSampleEntity`. Synchronizes the deletion with the external NLP provider * - * @param value - The NLP value to be deleted. + * @param _query - The Mongoose query object used for deletion. + * @param criteria - The filter criteria for finding the nlpValues to be deleted. + * + * @returns {Promise} A promise that resolves once the event is emitted. */ @OnEvent('hook:nlpValue:preDelete') - async handleValueDelete(_query: unknown, criteria: TFilterQuery) { + async handleValueDelete( + _query: unknown, + criteria: TFilterQuery, + ): Promise { if (criteria._id) { await this.nlpSampleEntityService.deleteMany({ value: criteria._id,