0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 07:29:08 -05:00

:sparkless: Add more project events to webhooks

This commit is contained in:
Andrey Antukh 2022-12-15 11:28:18 +01:00
parent bdd00be5e4
commit db7920435b

View file

@ -71,13 +71,16 @@
(s/keys :req-un [::profile-id ::id ::team-id ::is-pinned])) (s/keys :req-un [::profile-id ::id ::team-id ::is-pinned]))
(sv/defmethod ::update-project-pin (sv/defmethod ::update-project-pin
{::doc/added "1.0"
::webhooks/batch-timeout (dt/duration "5s")
::webhooks/batch-key :id
::webhooks/event? true}
[{:keys [pool] :as cfg} {:keys [id profile-id team-id is-pinned] :as params}] [{:keys [pool] :as cfg} {:keys [id profile-id team-id is-pinned] :as params}]
(db/with-atomic [conn pool] (db/with-atomic [conn pool]
(proj/check-edition-permissions! conn profile-id id) (proj/check-edition-permissions! conn profile-id id)
(db/exec-one! conn [sql:update-project-pin team-id id profile-id is-pinned is-pinned]) (db/exec-one! conn [sql:update-project-pin team-id id profile-id is-pinned is-pinned])
nil)) nil))
;; --- Mutation: Rename Project ;; --- Mutation: Rename Project
(declare rename-project) (declare rename-project)
@ -86,13 +89,19 @@
(s/keys :req-un [::profile-id ::name ::id])) (s/keys :req-un [::profile-id ::name ::id]))
(sv/defmethod ::rename-project (sv/defmethod ::rename-project
{::doc/added "1.0"
::webhooks/event? true}
[{:keys [pool] :as cfg} {:keys [id profile-id name] :as params}] [{:keys [pool] :as cfg} {:keys [id profile-id name] :as params}]
(db/with-atomic [conn pool] (db/with-atomic [conn pool]
(proj/check-edition-permissions! conn profile-id id) (proj/check-edition-permissions! conn profile-id id)
(db/update! conn :project (let [project (db/get-by-id conn :project id)]
{:name name} (db/update! conn :project
{:id id}) {:name name}
nil)) {:id id})
(rph/with-meta (rph/wrap)
{::audit/props {:team-id (:team-id project)
:prev-name (:name project)}}))))
;; --- Mutation: Delete Project ;; --- Mutation: Delete Project