started working on validation on action form.

This commit is contained in:
Bryce Covert
2018-05-23 12:07:51 -07:00
parent a3762a76af
commit 0611c169c7
6 changed files with 51 additions and 8 deletions

View File

@@ -1,15 +1,13 @@
(ns auto-ap.entities.companies
(:require [clojure.spec.alpha :as s]
[auto-ap.entities.shared :as shared]
[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)
(s/def ::identifier (s/nilable string?))
(s/def ::required-identifier (s/and string?
#(not (str/blank? %))))
(s/def ::name ::required-identifier)
(s/def ::name ::shared/required-identifier)
(s/def ::address ::address/address)
(s/def ::email (s/nilable (s/and string? (s/or :is-email #(re-matches email-regex %)