fix list apps

This commit is contained in:
Ruben Fiszel
2022-11-30 21:43:32 +01:00
parent 5dc9dfed72
commit 2845cce5ae
2 changed files with 11 additions and 2 deletions
+3
View File
@@ -4825,6 +4825,9 @@ components:
type: boolean
starred:
type: boolean
edited_at:
type: string
format: date-time
execution_mode:
type: string
enum: [viewer, publisher, anonymous]
+8 -2
View File
@@ -132,6 +132,7 @@ async fn list_apps(
"summary",
"versions[array_upper(versions, 1)] as version",
"policy->>'execution_mode' as execution_mode",
"app_version.created_at as edited_at",
"extra_perms",
"favorite.path IS NOT NULL as starred",
])
@@ -141,9 +142,14 @@ async fn list_apps(
"favorite.favorite_kind = 'app' AND favorite.workspace_id = app.workspace_id AND favorite.path = app.path AND favorite.usr = ?"
.bind(&authed.username),
)
.left()
.join("app_version")
.on(
"app_version.id = versions[array_upper(versions, 1)]"
)
.order_desc("favorite.path IS NOT NULL")
.order_by("path", true)
.and_where("workspace_id = ?".bind(&w_id))
.order_by("app_version.created_at", true)
.and_where("app.workspace_id = ? OR app.workspace_id = 'starter'".bind(&w_id))
.offset(offset)
.limit(per_page)
.clone();