Skip to content

Commit

Permalink
fix: use current model for hooks when restoring (#218)
Browse files Browse the repository at this point in the history
Co-authored-by: thommym <[email protected]>
  • Loading branch information
thommymo and thommym authored Oct 21, 2024
1 parent 964be81 commit a66e2d8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/resolvers/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ const restore = async (model: EntityModel, { where }: { where: any }, ctx: FullC
const data = { prev: relatedEntity, input: {}, normalizedInput, next: { ...relatedEntity, ...normalizedInput } };
if (ctx.mutationHook) {
beforeHooks.push(async () => {
await ctx.mutationHook(model, 'restore', 'before', data, ctx);
await ctx.mutationHook(currentModel, 'restore', 'before', data, ctx);
});
}
mutations.push(async () => {
Expand All @@ -288,7 +288,7 @@ const restore = async (model: EntityModel, { where }: { where: any }, ctx: FullC
});
if (ctx.mutationHook) {
afterHooks.push(async () => {
await ctx.mutationHook(model, 'restore', 'after', data, ctx);
await ctx.mutationHook(currentModel, 'restore', 'after', data, ctx);
});
}

Expand Down

0 comments on commit a66e2d8

Please sign in to comment.