mirror of
https://github.com/penpot/penpot.git
synced 2025-05-18 10:56:13 +02:00
✨ Add font events to webhooks
This commit is contained in:
parent
ae8000df26
commit
d80a24b1e3
2 changed files with 28 additions and 19 deletions
|
@ -62,7 +62,6 @@
|
||||||
:name (:name event))
|
:name (:name event))
|
||||||
|
|
||||||
(when-let [items (lookup-webhooks cfg event)]
|
(when-let [items (lookup-webhooks cfg event)]
|
||||||
;; (app.common.pprint/pprint items)
|
|
||||||
(l/trace :hint "webhooks found for event" :total (count items))
|
(l/trace :hint "webhooks found for event" :total (count items))
|
||||||
|
|
||||||
(db/with-atomic [conn pool]
|
(db/with-atomic [conn pool]
|
||||||
|
|
|
@ -110,12 +110,12 @@
|
||||||
]
|
]
|
||||||
|
|
||||||
(->> (generate-fonts data)
|
(->> (generate-fonts data)
|
||||||
(p/map validate-data)
|
(p/fmap validate-data)
|
||||||
(p/mcat executor persist-fonts)
|
(p/mcat executor persist-fonts)
|
||||||
(p/map executor insert-into-db)
|
(p/fmap executor insert-into-db)
|
||||||
(p/map (fn [result]
|
(p/fmap (fn [result]
|
||||||
(let [params (update params :data (comp vec keys))]
|
(let [params (update params :data (comp vec keys))]
|
||||||
(rph/with-meta result {::audit/replace-props params})))))))
|
(rph/with-meta result {::audit/replace-props params})))))))
|
||||||
|
|
||||||
;; --- UPDATE FONT FAMILY
|
;; --- UPDATE FONT FAMILY
|
||||||
|
|
||||||
|
@ -128,10 +128,15 @@
|
||||||
[{:keys [pool] :as cfg} {:keys [team-id profile-id id name] :as params}]
|
[{:keys [pool] :as cfg} {:keys [team-id profile-id id name] :as params}]
|
||||||
(db/with-atomic [conn pool]
|
(db/with-atomic [conn pool]
|
||||||
(teams/check-edition-permissions! conn profile-id team-id)
|
(teams/check-edition-permissions! conn profile-id team-id)
|
||||||
(db/update! conn :team-font-variant
|
(rph/with-meta
|
||||||
{:font-family name}
|
(db/update! conn :team-font-variant
|
||||||
{:font-id id
|
{:font-family name}
|
||||||
:team-id team-id})))
|
{:font-id id
|
||||||
|
:team-id team-id})
|
||||||
|
{::audit/replace-props {:id id
|
||||||
|
:name name
|
||||||
|
:team-id team-id
|
||||||
|
:profile-id profile-id}})))
|
||||||
|
|
||||||
;; --- DELETE FONT
|
;; --- DELETE FONT
|
||||||
|
|
||||||
|
@ -144,10 +149,14 @@
|
||||||
[{:keys [pool] :as cfg} {:keys [id team-id profile-id] :as params}]
|
[{:keys [pool] :as cfg} {:keys [id team-id profile-id] :as params}]
|
||||||
(db/with-atomic [conn pool]
|
(db/with-atomic [conn pool]
|
||||||
(teams/check-edition-permissions! conn profile-id team-id)
|
(teams/check-edition-permissions! conn profile-id team-id)
|
||||||
(db/update! conn :team-font-variant
|
(let [font (db/update! conn :team-font-variant
|
||||||
{:deleted-at (dt/now)}
|
{:deleted-at (dt/now)}
|
||||||
{:font-id id :team-id team-id})
|
{:font-id id :team-id team-id})]
|
||||||
nil))
|
(rph/with-meta (rph/wrap)
|
||||||
|
{::audit/props {:id id
|
||||||
|
:team-id team-id
|
||||||
|
:name (:font-family font)
|
||||||
|
:profile-id profile-id}}))))
|
||||||
|
|
||||||
;; --- DELETE FONT VARIANT
|
;; --- DELETE FONT VARIANT
|
||||||
|
|
||||||
|
@ -160,8 +169,9 @@
|
||||||
[{:keys [pool] :as cfg} {:keys [id team-id profile-id] :as params}]
|
[{:keys [pool] :as cfg} {:keys [id team-id profile-id] :as params}]
|
||||||
(db/with-atomic [conn pool]
|
(db/with-atomic [conn pool]
|
||||||
(teams/check-edition-permissions! conn profile-id team-id)
|
(teams/check-edition-permissions! conn profile-id team-id)
|
||||||
|
(let [variant (db/update! conn :team-font-variant
|
||||||
(db/update! conn :team-font-variant
|
{:deleted-at (dt/now)}
|
||||||
{:deleted-at (dt/now)}
|
{:id id :team-id team-id})]
|
||||||
{:id id :team-id team-id})
|
(rph/with-meta (rph/wrap)
|
||||||
nil))
|
{::audit/props {:font-family (:font-family variant)
|
||||||
|
:font-id (:font-id variant)}}))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue