Skip to content
Snippets Groups Projects
Unverified Commit 1b37e688 authored by Bryan Maass's avatar Bryan Maass Committed by GitHub
Browse files

Fixes some misses from http_actions routes (#23845)

- adds http_action PUT
- returns the http_action data on h2.
parent a9a1a49c
No related branches found
No related tags found
No related merge requests found
......@@ -99,6 +99,19 @@
(when (not= "http" (:type action))
(throw (ex-info (trs "Action type is not supported") action)))
(let [http-action (db/insert! HTTPAction action)]
(first (action/select-actions nil :id (:action_id http-action)))))
(if-let [action-id (:action_id http-action)]
(first (action/select-actions nil :id action-id))
;; db/insert! does not return a value when used with h2
;; so we return the most recently updated http action.
(last (action/select-actions nil :type "http")))))
(api/defendpoint PUT "/:id"
[id :as {action :body} database]
(when database
(do-check-actions-enabled database nil))
(when (not= "http" (:type action))
(throw (ex-info (trs "Action type is not supported") action)))
(db/update! HTTPAction id action)
(first (action/select-actions nil :id id)))
(api/define-routes actions/+check-actions-enabled api/+check-superuser)
......@@ -27,7 +27,7 @@
[action]
;; All possible sub-type columns
(when-let [sub-type-action (not-empty (select-keys action [:card_id :name :description :template :response_handle :error_handle]))]
(assoc sub-type-action :action_id (:id action))))
(assoc sub-type-action :action_id (or (:id action) (:action_id action)))))
(defn- pre-delete
[action]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment