From 981b2775e991096d84086a7db191c603bdf028cb Mon Sep 17 00:00:00 2001 From: Ayush Goyal Date: Sun, 16 May 2021 20:26:35 -0400 Subject: [PATCH] Fix requests search bug --- server/src/api/resolvers/query.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/server/src/api/resolvers/query.ts b/server/src/api/resolvers/query.ts index b9d35ad..08e317b 100644 --- a/server/src/api/resolvers/query.ts +++ b/server/src/api/resolvers/query.ts @@ -194,14 +194,16 @@ export const Query: QueryResolvers = { if (!context.user.admin) { // then if they are requesting requests for a user that is not themselves if (args.search.userId && args.search.userId !== context.user.uuid) { - // return an empty array and avoid making a DB query - return []; + return []; // return an empty array and avoid making a DB query } - // otherwise, restrict their results to just their user ID - searchObj.userId = context.user.uuid; - searchObj.item.location.hidden = false; // don't show hidden locations - searchObj.item.hidden = false; // don't show hidden items + searchObj.userId = context.user.uuid; // otherwise, restrict their results to just their user ID + searchObj.item = { + location: { + hidden: false, // don't show hidden locations + }, + hidden: false, // don't show hidden items + }; } const requests = await prisma.request.findMany({