feat: add custom email type for validation
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Moritz 2025-05-28 22:04:54 +02:00
parent 3e2140fda7
commit 859f5f4497
Signed by: moritz
GPG key ID: 1020A035E5DD0824
4 changed files with 43 additions and 18 deletions

View file

@ -2,13 +2,6 @@
#
# mix run priv/repo/seeds.exs
#
# Inside the script, you can read and write to any of your
# repositories directly:
#
# Mv.Repo.insert!(%Mv.SomeSchema{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as they will fail if something goes wrong.
alias Mv.Membership
@ -43,18 +36,15 @@ for attrs <- [
},
%{
name: "Email",
value_type: :string,
value_type: :email,
description: "Email-Adresse des Mitglieds",
immutable: true,
required: true
}
] do
# upsert?: true sorgt dafür, dass bei bestehendem Namen kein Fehler,
# sondern ein Update (hier effektiv No-Op) ausgeführt wird
{:ok, _} =
Membership.create_property_type(
attrs,
upsert?: true,
upsert_identity: :unique_name
)
Membership.create_property_type!(
attrs,
upsert?: true,
upsert_identity: :unique_name
)
end