mirror of
https://github.com/hexastack/hexabot
synced 2025-02-24 21:34:31 +00:00
fix: throw if no updates has been provided to updateOne
This commit is contained in:
parent
4972011dfd
commit
aaa24656d3
@ -488,7 +488,11 @@ export abstract class BaseRepository<
|
||||
);
|
||||
const filterCriteria = query.getFilter();
|
||||
const queryUpdates = query.getUpdate();
|
||||
if (queryUpdates) {
|
||||
|
||||
if (!queryUpdates) {
|
||||
throw new Error('updateOne() query updates are not undefined');
|
||||
}
|
||||
|
||||
await this.preUpdateValidate(filterCriteria, queryUpdates);
|
||||
this.emitter.emit(
|
||||
this.getEventName(EHook.preUpdateValidate),
|
||||
@ -502,8 +506,6 @@ export abstract class BaseRepository<
|
||||
filterCriteria,
|
||||
queryUpdates,
|
||||
);
|
||||
}
|
||||
|
||||
return await this.executeOne(query, this.cls);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user