From a66e2d80f05102d6785aa7efc67f8b1f5425a0f8 Mon Sep 17 00:00:00 2001 From: Thomas Moser Date: Mon, 21 Oct 2024 20:54:59 +0200 Subject: [PATCH] fix: use current model for hooks when restoring (#218) Co-authored-by: thommym --- src/resolvers/mutations.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/resolvers/mutations.ts b/src/resolvers/mutations.ts index e5dd92a..882aa62 100644 --- a/src/resolvers/mutations.ts +++ b/src/resolvers/mutations.ts @@ -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 () => { @@ -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); }); }