started working on validation on action form.
This commit is contained in:
14
src/cljc/auto_ap/entities/shared.cljc
Normal file
14
src/cljc/auto_ap/entities/shared.cljc
Normal 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 %)))
|
||||
Reference in New Issue
Block a user