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)],
|
where: [present(:join_date)],
|
||||||
message: "cannot be in the future"
|
message: "cannot be in the future"
|
||||||
|
|
||||||
|
|
||||||
# Exit date not before join date
|
# Exit date not before join date
|
||||||
validate compare(:exit_date, greater_than: :join_date),
|
validate compare(:exit_date, greater_than: :join_date),
|
||||||
where: [present([:join_date, :exit_date])],
|
where: [present([:join_date, :exit_date])],
|
||||||
message: "cannot be before join date"
|
message: "cannot be before join date"
|
||||||
|
|
||||||
|
|
||||||
# Phone number format (only if set)
|
# Phone number format (only if set)
|
||||||
validate match(:phone_number, ~r/^\+?[0-9\- ]{6,20}$/),
|
validate match(:phone_number, ~r/^\+?[0-9\- ]{6,20}$/),
|
||||||
where: [present(:phone_number)],
|
where: [present(:phone_number)],
|
||||||
message: "is not a valid phone number"
|
message: "is not a valid phone number"
|
||||||
|
|
||||||
|
|
||||||
# Postal code format (only if set)
|
# Postal code format (only if set)
|
||||||
validate match(:postal_code, ~r/^\d{5}$/),
|
validate match(:postal_code, ~r/^\d{5}$/),
|
||||||
where: [present(:postal_code)],
|
where: [present(:postal_code)],
|
||||||
message: "must consist of 5 digits"
|
message: "must consist of 5 digits"
|
||||||
|
|
||||||
|
|
||||||
# Email validation with EctoCommons.EmailValidator
|
# Email validation with EctoCommons.EmailValidator
|
||||||
validate fn changeset, _ ->
|
validate fn changeset, _ ->
|
||||||
email = Ash.Changeset.get_attribute(changeset, :email)
|
email = Ash.Changeset.get_attribute(changeset, :email)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue