mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: remove blank line, make updateOne asynchronous
This commit is contained in:
@@ -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 },
|
||||||
|
|||||||
Reference in New Issue
Block a user