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

🐛 Fix params inconsistency between mutation and commands

This commit is contained in:
Andrey Antukh 2022-12-15 12:27:08 +01:00
parent 4b26b6fc02
commit f47c20e079

View file

@ -105,7 +105,7 @@
"Ring handler that dispatches cmd requests and convert between "Ring handler that dispatches cmd requests and convert between
internal async flow into ring async flow." internal async flow into ring async flow."
[methods {:keys [profile-id session-id params] :as request} respond raise] [methods {:keys [profile-id session-id params] :as request} respond raise]
(let [cmd (keyword (:command params)) (let [cmd (keyword (:type params))
etag (yrq/get-header request "if-none-match") etag (yrq/get-header request "if-none-match")
data (into {::http/request request ::cond/key etag} params) data (into {::http/request request ::cond/key etag} params)
data (if profile-id data (if profile-id
@ -212,7 +212,7 @@
(l/debug :hint "register method" :name (::sv/name mdata)) (l/debug :hint "register method" :name (::sv/name mdata))
(with-meta (with-meta
(fn [{:keys [::request] :as params}] (fn [params]
;; Raise authentication error when rpc method requires auth but ;; Raise authentication error when rpc method requires auth but
;; no profile-id is found in the request. ;; no profile-id is found in the request.
@ -328,7 +328,7 @@
(defmethod ig/init-key ::routes (defmethod ig/init-key ::routes
[_ {:keys [methods] :as cfg}] [_ {:keys [methods] :as cfg}]
[["/rpc" [["/rpc"
["/command/:command" {:handler (partial rpc-command-handler (:commands methods))}] ["/command/:type" {:handler (partial rpc-command-handler (:commands methods))}]
["/query/:type" {:handler (partial rpc-query-handler (:queries methods))}] ["/query/:type" {:handler (partial rpc-query-handler (:queries methods))}]
["/mutation/:type" {:handler (partial rpc-mutation-handler (:mutations methods)) ["/mutation/:type" {:handler (partial rpc-mutation-handler (:mutations methods))
:allowed-methods #{:post}}]]]) :allowed-methods #{:post}}]]])