Skip to content
Snippets Groups Projects
Unverified Commit fd8865a8 authored by Howon Lee's avatar Howon Lee Committed by GitHub
Browse files

Cache ttls nillable now (#17852)

parent 1a29ab8b
No related branches found
No related tags found
No related merge requests found
......@@ -429,9 +429,9 @@
;; `collection_id` and `description` can be `nil` (in order to unset them). Other values should only be
;; modified if they're passed in as non-nil
(u/select-keys-when card-updates
:present #{:collection_id :collection_position :description}
:present #{:collection_id :collection_position :description :cache_ttl}
:non-nil #{:dataset_query :display :name :visualization_settings :archived :enable_embedding
:embedding_params :result_metadata :cache_ttl})))
:embedding_params :result_metadata})))
;; Fetch the updated Card from the DB
(let [card (Card id)]
(delete-alerts-if-needed! card-before-update card)
......
......@@ -301,9 +301,9 @@
;; description, position, collection_id, and collection_position are allowed to be `nil`.
;; Everything else must be non-nil
(u/select-keys-when dash-updates
:present #{:description :position :collection_id :collection_position}
:present #{:description :position :collection_id :collection_position :cache_ttl}
:non-nil #{:name :parameters :caveats :points_of_interest :show_in_getting_started :enable_embedding
:embedding_params :archived :cache_ttl})))))
:embedding_params :archived})))))
;; now publish an event and return the updated Dashboard
(let [dashboard (Dashboard id)]
(events/publish-event! :dashboard-update (assoc dashboard :actor_id api/*current-user-id*))
......
......@@ -409,8 +409,15 @@
:put
202
(str "card/" (u/the-id card))
{:cache_ttl 1234}))))))))
{:cache_ttl 1234}))))))
(testing "nilling out cache ttl works"
(mt/with-temp Card [card]
(is (= nil
(do
(mt/user-http-request :rasta :put 202 (str "card/" (u/the-id card)) {:cache_ttl 1234})
(mt/user-http-request :rasta :put 202 (str "card/" (u/the-id card)) {:cache_ttl nil})
(:cache_ttl (mt/user-http-request :rasta :get 200 (str "card/" (u/the-id card))))
)))))))
(defn- fingerprint-integers->doubles
"Converts the min/max fingerprint values to doubles so simulate how the FE will change the metadata when POSTing a
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment