fix: remove blank line, make updateOne asynchronous

This commit is contained in:
MohamedAliBouhaouala
2025-04-23 18:21:00 +01:00
parent 35505294fa
commit 023efad91b

View File

@@ -45,6 +45,7 @@ export class NlpEntityService extends BaseService<
async deleteCascadeOne(id: string) { async deleteCascadeOne(id: string) {
return await this.repository.deleteOne(id); return await this.repository.deleteOne(id);
} }
/** /**
* Updates the `weight` field of a specific NLP entity by its ID. * Updates the `weight` field of a specific NLP entity by its ID.
* *
@@ -55,13 +56,12 @@ export class NlpEntityService extends BaseService<
* @throws Error if the weight is not a positive integer. * @throws Error if the weight is not a positive integer.
* @returns A promise that resolves to the updated entity. * @returns A promise that resolves to the updated entity.
*/ */
async updateWeight(id: string, updatedWeight: number) { async updateWeight(id: string, updatedWeight: number) {
if (!Number.isInteger(updatedWeight) || updatedWeight < 1) { if (!Number.isInteger(updatedWeight) || updatedWeight < 1) {
throw new Error('Weight must be a positive integer'); throw new Error('Weight must be a positive integer');
} }
return this.repository.updateOne( return await this.repository.updateOne(
id, id,
{ weight: updatedWeight }, { weight: updatedWeight },
{ new: true }, { new: true },