🎉 Add RPC command for clone builtin template

This commit is contained in:
Andrey Antukh
2022-08-03 13:34:10 +02:00
parent ed701fd9c5
commit b8b60d9208
6 changed files with 75 additions and 5 deletions

View File

@@ -604,3 +604,19 @@
(t/is (= (:library-file-id item1) (:id file2))))
)))
(t/deftest clone-template
(let [prof (th/create-profile* 1 {:is-active true})
data {::th/type :clone-template
:profile-id (:id prof)
:project-id (:default-project-id prof)
:template-id "test"}
out (th/command! data)]
;; (th/print-result! out)
(t/is (nil? (:error out)))
(let [result (:result out)]
(t/is (set? result))
(t/is (uuid? (first result)))
(t/is (= 1 (count result))))))

Binary file not shown.

View File

@@ -50,11 +50,18 @@
(defn state-init
[next]
(let [config (-> main/system-config
(let [templates [{:id "test"
:name "test"
:file-uri "test"
:thumbnail-uri "test"
:path (-> "app/test_files/template.penpot" io/resource fs/path)}]
config (-> main/system-config
(assoc-in [:app.msgbus/msgbus :redis-uri] (:redis-uri config))
(assoc-in [:app.db/pool :uri] (:database-uri config))
(assoc-in [:app.db/pool :username] (:database-username config))
(assoc-in [:app.db/pool :password] (:database-password config))
(assoc-in [:app.rpc/methods :templates] templates)
(dissoc :app.srepl/server
:app.http/server
:app.http/router
@@ -64,6 +71,7 @@
:app.auth.oidc/gitlab-provider
:app.auth.oidc/github-provider
:app.auth.oidc/generic-provider
:app.setup/builtin-templates
:app.auth.oidc/routes
;; :app.auth.ldap/provider
:app.worker/executors-monitor