fix: address review

This commit is contained in:
hexastack
2024-11-18 15:32:34 +01:00
parent e0a7a783f9
commit 82e47f23dd
4 changed files with 83 additions and 68 deletions

View File

@@ -172,6 +172,15 @@ export abstract class BaseRepository<
);
});
hooks?.updateMany.post.execute(async function (updated: any) {
const query = this as Query<D, D, unknown, T, 'updateMany'>;
await repository.postUpdateMany(query, updated);
repository.emitter.emit(
repository.getEventName(EHook.postUpdateMany),
updated,
);
});
hooks?.findOneAndUpdate.post.execute(async function (
updated: HydratedDocument<T>,
) {
@@ -398,6 +407,13 @@ export abstract class BaseRepository<
// Nothing ...
}
async postUpdateMany(
_query: Query<D, D, unknown, T, 'updateMany'>,
_updated: any,
) {
// Nothing ...
}
async postUpdate(
_query: Query<D, D, unknown, T, 'findOneAndUpdate'>,
_updated: T,