outstanding balance and addresses.

This commit is contained in:
Bryce Covert
2018-05-17 19:37:50 -07:00
parent 7b7275f7a4
commit e055a1e120
19 changed files with 351 additions and 98 deletions

View File

@@ -0,0 +1,17 @@
(ns auto-ap.entities.address
(:require [clojure.spec.alpha :as s]
[clojure.string :as str]))
(s/def ::street1 (s/nilable string?))
(s/def ::street2 (s/nilable string?))
(s/def ::city (s/nilable string?))
(s/def ::state (s/nilable (s/and string?
#(re-matches #"[a-zA-Z]{2}" %))))
(s/def ::zip (s/nilable string?))
(s/def ::address (s/keys :opt-un [::email
::street1
::street2
::city
::state
::zip]))

View File

@@ -1,6 +1,7 @@
(ns auto-ap.entities.companies
(:require [clojure.spec.alpha :as s]
[clojure.string :as str]))
[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 int)
@@ -9,14 +10,15 @@
#(not (str/blank? %))))
(s/def ::name ::required-identifier)
(s/def ::data map?)
(s/def ::address ::address/address)
(s/def ::email (s/nilable (s/and string? (s/or :is-email #(re-matches email-regex %)
:is-empty #(= % "")))))
(s/def ::company (s/keys :req-un [::name]
:opt-un [::email
::data
::address
::id]))