Adds the ability to change searching

This commit is contained in:
2023-02-03 20:16:38 -08:00
parent d08253e5fa
commit 4433bf905d
7 changed files with 1721 additions and 21 deletions

View File

@@ -9,11 +9,13 @@
(defn <-datomic [a]
(-> a
(update :account/applicability :db/ident)
(update :account/invoice-allowance :db/ident)))
(update :account/invoice-allowance :db/ident)
(update :account/vendor-allowance :db/ident)))
(def default-read ['* {:account/type [:db/ident :db/id]
:account/applicability [:db/ident :db/id]
:account/invoice-allowance [:db/ident :db/id]
:account/vendor-allowance [:db/ident :db/id]
:account/client-overrides [:db/id
:account-client-override/name
{:account-client-override/client [:db/id :client/name]}]}])

View File

@@ -176,6 +176,16 @@
:account/invoice-allowance :allowance/allowed})))
])
(defn backfill-account-options2 [conn]
[(->> (d/q '[:find [?a ...]
:in $
:where [?a :account/name]]
(d/db conn))
(map (fn [i]
{:db/id i
:account/vendor-allowance :allowance/allowed})))
])
(defn migrate [conn]
(let [
@@ -541,22 +551,32 @@
:requires [:auto-ap/add-account-overrides]}
:auto-ap/add-search-terms-accounts {:txes-fn `add-account-search-terms
:requires [:auto-ap/fulltext-accounts]}
:auto-ap/add-account-options {:txes [[{:db/ident :account/invoice-allowance
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/one
:db/doc "Whether this account can be used for invoices"}
{:db/ident :allowance/allowed
:db/doc "Allowed to be used"}
{:db/ident :allowance/denied
:db/doc "Denied usage"}
{:db/ident :allowance/warn
:db/doc "Warn on usage"}
{:db/ident :allowance/admin-only
:db/doc "Only admins can use it"}
:requires [:auto-ap/add-search-terms-accounts]]]}
:auto-ap/add-account-options {:txes [[{:db/ident :account/invoice-allowance
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/one
:db/doc "Whether this account can be used for invoices"}
{:db/ident :allowance/allowed
:db/doc "Allowed to be used"}
{:db/ident :allowance/denied
:db/doc "Denied usage"}
{:db/ident :allowance/warn
:db/doc "Warn on usage"}
{:db/ident :allowance/admin-only
:db/doc "Only admins can use it"}]]
:requires [:auto-ap/add-search-terms-accounts]}
:auto-ap/backfill-account-options {:txes-fn `backfill-account-options
:requires [:auto-ap/add-account-options]}}
:requires [:auto-ap/add-account-options]}
:auto-ap/add-vendor-account-options {:txes [[{:db/ident :account/vendor-allowance
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/one
:db/doc "Whether this account can be used for vendors"}
]]
:requires [:auto-ap/backfill-account-options]}
:auto-ap/backfill-account-options2 {:txes-fn `backfill-account-options2
:requires [:auto-ap/add-vendor-account-options]}}