makes POS page much less likely to break everything

This commit is contained in:
2023-04-05 22:50:38 -07:00
parent e7ae418614
commit 2a0f736af7
6 changed files with 441 additions and 501 deletions

View File

@@ -853,3 +853,21 @@
:status "WARN")
(transact-with-backoff tx (inc attempt)))
(throw e))))))
(defn visible-clients [id]
(cond
(= (:user/role id) "none")
#{}
(= (:user/role id) "admin")
(->> (dc/q '[:find (pull ?e [:db/id :client/code])
:in $
:where [?e :client/code]]
(dc/db conn))
(map first)
(map :db/id)
(into #{}))
(#{"manager" "user" "power-user"} (:user/role id))
(into #{}
(map :db/id (:user/clients id [])))))