member and properties

This commit is contained in:
Moritz 2025-04-28 17:56:58 +02:00
parent 5ce9694d2f
commit d01ae6af96
Signed by: moritz
GPG key ID: 1020A035E5DD0824
10 changed files with 455 additions and 1 deletions

View file

@ -9,3 +9,31 @@
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as they will fail if something goes wrong.
alias Mv.Membership
for attrs <- [
%{
name: "Vorname",
type: "string",
description: "Vorname des Mitglieds",
immutable: true,
required: true
},
%{
name: "Email",
type: "string",
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
)
end