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

@@ -0,0 +1,14 @@
(ns auto-ap.entities.shared
(:require [clojure.spec.alpha :as s]
[clojure.string :as str]))
(def date-regex #"[0-9]{1,2}/[0-9]{1,2}/[0-9]{4}")
(def money-regex #"[0-9]+(\.[0-9]{1,2})?$")
(s/def ::identifier (s/nilable string?))
(s/def ::date (s/and string? #(re-matches date-regex %)))
(s/def ::required-identifier (s/and string?
#(not (str/blank? %))))
(s/def ::money (s/and string?
#(re-matches money-regex %)))