From 2845cce5ae7e9119d7ae77510c2d90b516ca56a2 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Wed, 30 Nov 2022 21:43:32 +0100 Subject: [PATCH] fix list apps --- backend/windmill-api/openapi.yaml | 3 +++ backend/windmill-api/src/apps.rs | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/backend/windmill-api/openapi.yaml b/backend/windmill-api/openapi.yaml index 8d2d41ea16..57ec973fd4 100644 --- a/backend/windmill-api/openapi.yaml +++ b/backend/windmill-api/openapi.yaml @@ -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] diff --git a/backend/windmill-api/src/apps.rs b/backend/windmill-api/src/apps.rs index f67ea630a4..f66789095f 100644 --- a/backend/windmill-api/src/apps.rs +++ b/backend/windmill-api/src/apps.rs @@ -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();