Adds support for more than one email address.

This commit is contained in:
2022-03-24 15:45:49 -07:00
parent 5d17091847
commit 1e7f8f9b0a
9 changed files with 58 additions and 16 deletions

View File

@@ -29,7 +29,8 @@
:bank-account/intuit-bank-account [:intuit-bank-account/name :intuit-bank-account/external-id :db/id]}
]}
{:yodlee-provider-account/_client [*]}
{:plaid-item/_client [*]}])
{:plaid-item/_client [*]}
{:client/emails [:db/id :email-contact/email :email-contact/description]}])
:where [?e :client/name]]
(d/db (d/connect uri)))
(map first)
@@ -42,7 +43,8 @@
'[* {:client/bank-accounts [* {:bank-account/type [*]
:bank-account/yodlee-account [:yodlee-account/name :yodlee-account/id :yodlee-account/number]
:bank-account/intuit-bank-account [:intuit-bank-account/name :intuit-bank-account/external-id :db/id]
:bank-account/plaid-account [:plaid-account/name :db/id :plaid-account/number :plaid-account/balance]}]}
:bank-account/plaid-account [:plaid-account/name :db/id :plaid-account/number :plaid-account/balance]}]
:client/emails [:db/id :email-contact/email :email-contact/description]}
{:yodlee-provider-account/_client [*]}
{:plaid-item/_client [*]}]
id)

View File

@@ -58,4 +58,18 @@
{:txes [[{:db/ident :client/locked-until
:db/doc "No new data before this date can be added/changed"
:db/valueType :db.type/instant
:db/cardinality :db.cardinality/one}]]}})
:db/cardinality :db.cardinality/one}]]}
::add-email-contacts
{:txes [[{:db/ident :email-contact/email
:db/doc "Email contact's email"
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one}
{:db/ident :email-contact/description
:db/doc "Manager, Owner, etc"
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one}
{:db/ident :client/emails
:db/doc "collection of email contacts"
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/many}]]}
})

View File

@@ -258,7 +258,7 @@
:check (str (+ index (:bank-account/check-number bank-account)))
:memo memo
:date (date->str (local-now))
:client (dissoc client :client/bank-accounts :client/locked-until)
:client (dissoc client :client/bank-accounts :client/locked-until :client/emails)
:bank-account (dissoc bank-account :bank-account/start-date)
#_#_:client {:name (:name client)
:address (:address client)

View File

@@ -136,6 +136,12 @@
(:bank_accounts edit_client))
})
[:reset id :client/emails (map #(remove-nils
{:db/id (or (:id %)
(str (UUID/randomUUID)))
:email-contact/email (:email %)
:email-contact/description (:description %)})
(:emails edit_client))]
[:reset id :client/forecasted-transactions (map #(remove-nils
{:db/id (:id %)
:forecasted-transaction/day-of-month (:day_of_month %)
@@ -267,6 +273,10 @@
:match {:type 'String}
:id {:type :id}}}
:email_contact {:fields {:id {:type :id}
:email {:type 'String}
:description {:type 'String}}}
:client
{:fields {:id {:type :id}
:name {:type 'String}
@@ -278,6 +288,7 @@
:week_b_debits {:type :money}
:week_b_credits {:type :money}
:email {:type 'String}
:emails {:type '(list :email_contact)}
:address {:type :address}
:location_matches {:type '(list :location_match)}
:locations {:type '(list String)}
@@ -335,12 +346,16 @@
:id {:type :id}
:day_of_month {:type 'Int}
:amount {:type :money}}}
:edit_email_contact {:fields {:id {:type :id}
:email {:type 'String}
:description {:type 'String}}}
:edit_client {:fields {:id {:type :id}
:name {:type 'String}
:locked_until {:type :iso_date}
:code {:type 'String}
:signature_data {:type 'String}
:email {:type 'String}
:emails {:type '(list :edit_email_contact)}
:week_a_credits {:type :money}
:week_a_debits {:type :money}
:week_b_credits {:type :money}

View File

@@ -506,4 +506,4 @@
:input-stream (io/make-input-stream pdf-data {})
:metadata {:content-length (count pdf-data)
:content-type "application/pdf"})
(str "http://" (:data-bucket env) ".s3-website-us-east-1.amazonaws.com/reports/pnl/" uuid ".pdf")))
(str "https://" (:data-bucket env) ".s3-website-us-east-1.amazonaws.com/reports/pnl/" uuid ".pdf")))

View File

@@ -46,7 +46,7 @@
(let [jwt (jwt/sign {:user (:name profile)
:exp (time/plus (time/now) (time/days 30))
:user/clients (map (fn [c]
(dissoc c :client/bank-accounts :client/location-matches :client/forecasted-transactions :client/matches :client/week-a-debits :client/week-a-credits :client/week-b-debits :client/week-b-credits :client/signature-file :client/address))
(dissoc c :client/bank-accounts :client/location-matches :client/forecasted-transactions :client/matches :client/week-a-debits :client/week-a-credits :client/week-b-debits :client/week-b-credits :client/signature-file :client/address :client/emails))
(:user/clients user))
:user/role (name (:user/role user))
:user/name (:name profile)}