vendors can be updated through datomic.
This commit is contained in:
14
src/cljc/auto_ap/entities/contact.cljc
Normal file
14
src/cljc/auto_ap/entities/contact.cljc
Normal file
@@ -0,0 +1,14 @@
|
||||
(ns auto-ap.entities.contact
|
||||
(:require [clojure.spec.alpha :as s]
|
||||
[clojure.string :as str]
|
||||
[auto-ap.entities.address :as address]))
|
||||
|
||||
(def email-regex #"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$")
|
||||
|
||||
(s/def ::id (s/nilable string?))
|
||||
(s/def ::name (s/nilable string?))
|
||||
(s/def ::email (s/nilable (s/and string? (s/or :is-email #(re-matches email-regex %)
|
||||
:is-empty #(= % "")))))
|
||||
(s/def ::phone (s/nilable string?))
|
||||
|
||||
(s/def ::contact (s/keys :opt-un [::name ::email ::phone ::id]))
|
||||
@@ -1,28 +1,20 @@
|
||||
(ns auto-ap.entities.vendors
|
||||
(:require [clojure.spec.alpha :as s]
|
||||
[clojure.string :as str]
|
||||
[auto-ap.entities.contact :as contact]
|
||||
[auto-ap.entities.address :as address]))
|
||||
|
||||
(def email-regex #"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$")
|
||||
(s/def ::id int)
|
||||
(s/def ::id string?)
|
||||
(s/def ::identifier (s/nilable string?)) (s/def ::required-identifier (s/and string?
|
||||
#(not (str/blank? %))))
|
||||
|
||||
(s/def ::name ::required-identifier)
|
||||
(s/def ::print-as (s/nilable string?))
|
||||
|
||||
(s/def ::email (s/nilable (s/and string? (s/or :is-email #(re-matches email-regex %)
|
||||
:is-empty #(= % "")))))
|
||||
(s/def ::phone (s/nilable string?))
|
||||
|
||||
(s/def ::invoice-reminder-schedule (s/nilable #{"Weekly" "Never" nil}))
|
||||
(s/def ::primary-contact (s/nilable ::identifier))
|
||||
(s/def ::primary-email (s/nilable ::email))
|
||||
(s/def ::primary-phone (s/nilable ::phone))
|
||||
|
||||
(s/def ::secondary-contact (s/nilable ::identifier))
|
||||
(s/def ::secondary-email (s/nilable ::email))
|
||||
(s/def ::secondary-phone (s/nilable ::phone))
|
||||
(s/def ::primary-contact (s/nilable ::contact/contact))
|
||||
(s/def ::secondary-contact (s/nilable ::contact/contact))
|
||||
(s/def ::address (s/nilable ::address/address))
|
||||
(s/def ::default-expense-account int?)
|
||||
|
||||
@@ -35,14 +27,8 @@
|
||||
::print-as
|
||||
::invoice-reminder-schedule
|
||||
::primary-contact
|
||||
::primary-email
|
||||
::primary-phone
|
||||
::secondary-contact
|
||||
::secondary-email
|
||||
::secondary-phone
|
||||
::address
|
||||
|
||||
]))
|
||||
::address]))
|
||||
|
||||
|
||||
(def vendor-spec (apply hash-map (drop 1 (s/form ::vendor))))
|
||||
|
||||
Reference in New Issue
Block a user