a lot of de-duplicating.
This commit is contained in:
@@ -1,20 +1,26 @@
|
||||
(ns auto-ap.entities.vendors
|
||||
(:require [clojure.spec.alpha :as s]))
|
||||
(:require [clojure.spec.alpha :as s]
|
||||
[clojure.string :as str]))
|
||||
|
||||
(def email-regex #"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$")
|
||||
(s/def ::id int)
|
||||
(s/def ::name (s/nilable string?))
|
||||
(s/def ::identifier (s/nilable string?))
|
||||
(s/def ::required-identifier (s/and string?
|
||||
#(not (str/blank? %))))
|
||||
|
||||
(s/def ::name ::required-identifier)
|
||||
|
||||
(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 ::data (s/nilable string?))
|
||||
(s/def ::invoice-reminder-schedule (s/nilable string?))
|
||||
(s/def ::primary-contact ::name)
|
||||
(s/def ::invoice-reminder-schedule (s/nilable #{"Weekly" "Never" nil}))
|
||||
(s/def ::primary-contact ::identifier)
|
||||
(s/def ::primary-email ::email)
|
||||
(s/def ::primary-phone ::phone)
|
||||
|
||||
(s/def ::secondary-contact ::name)
|
||||
(s/def ::secondary-contact ::identifier)
|
||||
(s/def ::secondary-email ::email)
|
||||
(s/def ::secondary-phone ::phone)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user