mirror of
https://github.com/penpot/penpot.git
synced 2025-03-10 14:51:37 -05:00
🎉 Add RPC method for retrieve the list of builtin templates
This commit is contained in:
parent
052404b1b4
commit
6981d92b11
2 changed files with 21 additions and 0 deletions
|
@ -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)))
|
||||
|
|
|
@ -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)))))))
|
||||
|
|
Loading…
Add table
Reference in a new issue