From 1f134b7e6e5ba28a1831145f658fe2fa5223ebbb Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Mon, 5 Apr 2021 23:35:44 +1000 Subject: [PATCH] Added a field filter --- test/handlers/query-handlers.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/handlers/query-handlers.js b/test/handlers/query-handlers.js index 8e6f904..10f5b86 100644 --- a/test/handlers/query-handlers.js +++ b/test/handlers/query-handlers.js @@ -70,6 +70,13 @@ const queryHandlers = { //for each author, update this non-scalar field with the non-scalar's recursed value authorResults = authorResults.map(author => { author[nonScalar] = nonScalarArray.filter(ns => ns['authorId'] == author.id); + + //BUGFIX: filter out extra authorId + author[nonScalar] = author[nonScalar].map(ns => { + const { authorId, ...res } = ns; + return res; + }); //extract authorId + return author; });