diff --git a/backend/src/app/rpc/commands/management.clj b/backend/src/app/rpc/commands/management.clj index 25cccad76..4e43d7961 100644 --- a/backend/src/app/rpc/commands/management.clj +++ b/backend/src/app/rpc/commands/management.clj @@ -392,3 +392,12 @@ (assoc ::binfile/ignore-index-errors? true) (assoc ::binfile/migrate? true) (binfile/import!)))) + + +;; --- COMMAND: Retrieve list of builtin templates + +(s/def ::retrieve-list-of-builtin-templates any?) + +(sv/defmethod ::retrieve-list-of-builtin-templates + [cfg _params] + (mapv #(select-keys % [:id :name]) (:templates cfg))) diff --git a/backend/test/app/services_management_test.clj b/backend/test/app/services_management_test.clj index 2724ee1db..f738e52e7 100644 --- a/backend/test/app/services_management_test.clj +++ b/backend/test/app/services_management_test.clj @@ -620,3 +620,15 @@ (t/is (set? result)) (t/is (uuid? (first result))) (t/is (= 1 (count result)))))) + +(t/deftest retrieve-list-of-buitin-templates + (let [prof (th/create-profile* 1 {:is-active true}) + data {::th/type :retrieve-list-of-builtin-templates + :profile-id (:id prof)} + out (th/command! data)] + ;; (th/print-result! out) + (t/is (nil? (:error out))) + (let [result (:result out)] + (t/is (vector? result)) + (t/is (= 1 (count result))) + (t/is (= "test" (:id (first result)))))))