From 014453931f2d50679d57f8484310cee5ad53485b Mon Sep 17 00:00:00 2001 From: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com> Date: Mon, 9 Sep 2024 18:30:22 -0600 Subject: [PATCH] fix admin search (#15) Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com> --- genhooks/templates/search/graph.tpl | 9 +++++++++ genhooks/templates/search/query.tpl | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/genhooks/templates/search/graph.tpl b/genhooks/templates/search/graph.tpl index 463cec1..2f50b0c 100644 --- a/genhooks/templates/search/graph.tpl +++ b/genhooks/templates/search/graph.tpl @@ -38,6 +38,15 @@ extend type Query{ """ query: String! ): SearchResultConnection + """ + Admin search across all objects + """ + adminSearch( + """ + Search query + """ + query: String! + ): SearchResultConnection } {{ range $object := $.Objects }} type {{ $object.Name }}SearchResult { diff --git a/genhooks/templates/search/query.tpl b/genhooks/templates/search/query.tpl index 9da4bfa..2f7db5c 100644 --- a/genhooks/templates/search/query.tpl +++ b/genhooks/templates/search/query.tpl @@ -1,5 +1,9 @@ query {{ $.Name }}Search($query: String!) { + {{- if eq $.Name "Admin" }} + adminSearch(query: $query) { + {{- else }} search(query: $query) { + {{- end }} nodes { {{- range $object := $.Objects }} ... on {{ $object.Name | toUpperCamel }}SearchResult {