From ce37b46de0a481b9a76215dca632ff8b012e41e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Wed, 15 Apr 2020 10:03:54 +0200 Subject: [PATCH] :bug: Retrieve complete information for files in dashboard search --- backend/src/uxbox/services/queries/files.clj | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/src/uxbox/services/queries/files.clj b/backend/src/uxbox/services/queries/files.clj index 6e28c4dca..b28b477f7 100644 --- a/backend/src/uxbox/services/queries/files.clj +++ b/backend/src/uxbox/services/queries/files.clj @@ -55,10 +55,17 @@ ppr.is_owner = true or ppr.can_edit = true) ) - select file.* + select distinct + file.*, + array_agg(page.id) over pages_w as pages, + first_value(page.data) over pages_w as data from file inner join projects as pr on (file.project_id = pr.id) + left join page on (file.id = page.file_id) where file.name ilike ('%' || $3 || '%') + window pages_w as (partition by file.id order by page.created_at + range between unbounded preceding + and unbounded following) order by file.created_at asc") (s/def ::search-files