Adds ezcater fikes.
This commit is contained in:
@@ -7,7 +7,6 @@
|
|||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[clojure.data.json :as json]
|
[clojure.data.json :as json]
|
||||||
[clj-time.coerce :as coerce]
|
[clj-time.coerce :as coerce]
|
||||||
[clojure.tools.logging :as log]
|
|
||||||
[clj-time.core :as time]
|
[clj-time.core :as time]
|
||||||
[clojure.set :as set]
|
[clojure.set :as set]
|
||||||
[auto-ap.time :as atime]
|
[auto-ap.time :as atime]
|
||||||
@@ -95,6 +94,7 @@
|
|||||||
:eventKey 'cancelled}}
|
:eventKey 'cancelled}}
|
||||||
[[:subscription [:parentId :parentEntity :eventEntity :eventKey]]]]]})))))
|
[[:subscription [:parentId :parentEntity :eventEntity :eventKey]]]]]})))))
|
||||||
|
|
||||||
|
|
||||||
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
|
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
|
||||||
(defn upsert-ezcater
|
(defn upsert-ezcater
|
||||||
([] (upsert-ezcater (get-integrations)))
|
([] (upsert-ezcater (get-integrations)))
|
||||||
@@ -108,7 +108,8 @@
|
|||||||
:integration-status/last-updated (coerce/to-date (time/now))})
|
:integration-status/last-updated (coerce/to-date (time/now))})
|
||||||
|
|
||||||
(catch Exception e
|
(catch Exception e
|
||||||
(log/warn e)
|
(alog/warn ::cant-upsert-ezcater
|
||||||
|
:exception e)
|
||||||
(mark-integration-status integration {:integration-status/state :integration-state/failed
|
(mark-integration-status integration {:integration-status/state :integration-state/failed
|
||||||
:integration-status/message (.getMessage e)}))))))
|
:integration-status/message (.getMessage e)}))))))
|
||||||
|
|
||||||
@@ -277,6 +278,7 @@
|
|||||||
(update-in [:sales-order/charges 0 :charge/date] coerce/to-date))])))
|
(update-in [:sales-order/charges 0 :charge/date] coerce/to-date))])))
|
||||||
|
|
||||||
(defn upsert-recent []
|
(defn upsert-recent []
|
||||||
|
(upsert-ezcater)
|
||||||
(let [last-sunday (coerce/to-date (time/plus (second (->> (time/today)
|
(let [last-sunday (coerce/to-date (time/plus (second (->> (time/today)
|
||||||
(iterate #(time/plus % (time/days -1)))
|
(iterate #(time/plus % (time/days -1)))
|
||||||
(filter #(= 7 (time/day-of-week %)))))
|
(filter #(= 7 (time/day-of-week %)))))
|
||||||
@@ -293,7 +295,8 @@
|
|||||||
[?c2 :ezcater-caterer/uuid ?uuid]]
|
[?c2 :ezcater-caterer/uuid ?uuid]]
|
||||||
(d/db conn)
|
(d/db conn)
|
||||||
last-sunday)
|
last-sunday)
|
||||||
:let [_ (log/info "Considering updating " order)
|
:let [_ (alog/info ::considering
|
||||||
|
:order order)
|
||||||
id (last (str/split order #"/"))
|
id (last (str/split order #"/"))
|
||||||
id (str/join "-" (drop 2 (str/split order #"-")))
|
id (str/join "-" (drop 2 (str/split order #"-")))
|
||||||
lookup-map {"id" "bf3dcf5c-a68f-42d9-9084-049133e03d3d",
|
lookup-map {"id" "bf3dcf5c-a68f-42d9-9084-049133e03d3d",
|
||||||
@@ -341,7 +344,8 @@
|
|||||||
:when (not= updated-order extant-order)]
|
:when (not= updated-order extant-order)]
|
||||||
|
|
||||||
updated-order))]
|
updated-order))]
|
||||||
(log/info "Found these orders to update:" orders-to-update)
|
(alog/info :found-orders-to-update
|
||||||
|
:orders orders-to-update)
|
||||||
@(d/transact conn orders-to-update)))
|
@(d/transact conn orders-to-update)))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,29 @@
|
|||||||
;; this catches an error where you choose a parameter, change to invoices page, then change to voided invoices
|
;; this catches an error where you choose a parameter, change to invoices page, then change to voided invoices
|
||||||
(println "Error!" e)))))
|
(println "Error!" e)))))
|
||||||
|
|
||||||
|
(re-frame/reg-event-fx
|
||||||
|
::unset-selected
|
||||||
|
(fn [cofx [_ params suppress]]
|
||||||
|
(let [checked @(re-frame/subscribe [::data-page/checked ::page])
|
||||||
|
checked-params (get checked "header")
|
||||||
|
specific-transactions (map :id (vals (dissoc checked "header")))]
|
||||||
|
{:db (-> (:db cofx)
|
||||||
|
(assoc-in [:status :loading] true))
|
||||||
|
:graphql {:token (-> cofx :db :user)
|
||||||
|
:owns-state {:single ::delete-selected}
|
||||||
|
:query-obj
|
||||||
|
{:venia/operation {:operation/type :mutation
|
||||||
|
:operation/name "DeleteTransactions"}
|
||||||
|
:venia/queries [{:query/data
|
||||||
|
[:delete-transactions
|
||||||
|
{:filters (some-> checked-params data-params->query-params)
|
||||||
|
:ids specific-transactions
|
||||||
|
:suppress suppress}
|
||||||
|
[:message]]}]}
|
||||||
|
:on-success (fn [_]
|
||||||
|
[::params-change params])}
|
||||||
|
:dispatch-n [[::data-page/reset-checked ::page]
|
||||||
|
[::modal/modal-closed]]})))
|
||||||
(re-frame/reg-event-fx
|
(re-frame/reg-event-fx
|
||||||
::delete-selected
|
::delete-selected
|
||||||
(fn [cofx [_ params suppress]]
|
(fn [cofx [_ params suppress]]
|
||||||
|
|||||||
Reference in New Issue
Block a user