This commit is contained in:
parent
35a8885267
commit
db3485af66
1 changed files with 0 additions and 4 deletions
|
|
@ -77,25 +77,21 @@ defmodule Mv.Membership.Member do
|
|||
where: [present(:join_date)],
|
||||
message: "cannot be in the future"
|
||||
|
||||
|
||||
# Exit date not before join date
|
||||
validate compare(:exit_date, greater_than: :join_date),
|
||||
where: [present([:join_date, :exit_date])],
|
||||
message: "cannot be before join date"
|
||||
|
||||
|
||||
# Phone number format (only if set)
|
||||
validate match(:phone_number, ~r/^\+?[0-9\- ]{6,20}$/),
|
||||
where: [present(:phone_number)],
|
||||
message: "is not a valid phone number"
|
||||
|
||||
|
||||
# Postal code format (only if set)
|
||||
validate match(:postal_code, ~r/^\d{5}$/),
|
||||
where: [present(:postal_code)],
|
||||
message: "must consist of 5 digits"
|
||||
|
||||
|
||||
# Email validation with EctoCommons.EmailValidator
|
||||
validate fn changeset, _ ->
|
||||
email = Ash.Changeset.get_attribute(changeset, :email)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue