From b1b26862a67f60dbdad8647e5b61695b45aee6a3 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 26 Sep 2023 15:02:47 +0200 Subject: [PATCH] fix(backend): postType as array in searchPosts --- backend/src/schema/resolvers/searches.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/src/schema/resolvers/searches.ts b/backend/src/schema/resolvers/searches.ts index fba74ecc7..5f4097c17 100644 --- a/backend/src/schema/resolvers/searches.ts +++ b/backend/src/schema/resolvers/searches.ts @@ -110,7 +110,13 @@ const searchResultPromise = async (session, setup, params) => { } const searchResultCallback = (result) => { - return result.records.map((r) => r.get('result')) + const response = result.records.map((r) => r.get('result')) + if (Array.isArray(response) && response.length && response[0].__typename === 'Post') { + response.forEach((post) => { + post.postType = [post.postType] + }) + } + return response } const countResultCallback = (result) => {