fix(api): add JSDoc

This commit is contained in:
yassinedorbozgithub 2025-06-17 15:10:36 +01:00
parent 91322cc165
commit dad6b55789

View File

@ -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<void>} A promise that resolves once the event is emitted.
*/ */
@OnEvent('hook:nlpEntity:preDelete') @OnEvent('hook:nlpEntity:preDelete')
async handleEntityDelete(_query: unknown, criteria: TFilterQuery<NlpEntity>) { async handleEntityDelete(
_query: unknown,
criteria: TFilterQuery<NlpEntity>,
): Promise<void> {
if (criteria._id) { if (criteria._id) {
await this.nlpValueService.deleteMany({ entity: criteria._id }); await this.nlpValueService.deleteMany({ entity: criteria._id });
await this.nlpSampleEntityService.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<void>} A promise that resolves once the event is emitted.
*/ */
@OnEvent('hook:nlpValue:preDelete') @OnEvent('hook:nlpValue:preDelete')
async handleValueDelete(_query: unknown, criteria: TFilterQuery<NlpValue>) { async handleValueDelete(
_query: unknown,
criteria: TFilterQuery<NlpValue>,
): Promise<void> {
if (criteria._id) { if (criteria._id) {
await this.nlpSampleEntityService.deleteMany({ await this.nlpSampleEntityService.deleteMany({
value: criteria._id, value: criteria._id,