feat: adds settings live view and updated seeds
This commit is contained in:
parent
193618eace
commit
37553d8d6c
6 changed files with 144 additions and 9 deletions
|
|
@ -323,8 +323,27 @@ if friedrich = find_member.("friedrich.wagner@example.de") do
|
|||
end)
|
||||
end
|
||||
|
||||
# Create or update global settings (singleton)
|
||||
default_club_name = System.get_env("ASSOCIATION_NAME") || "Club Name"
|
||||
|
||||
case Membership.get_settings() do
|
||||
{:ok, existing_settings} ->
|
||||
# Settings exist, update if club_name is different from env var
|
||||
if existing_settings.club_name != default_club_name do
|
||||
{:ok, _updated} =
|
||||
Membership.update_settings(existing_settings, %{club_name: default_club_name})
|
||||
end
|
||||
|
||||
{:ok, nil} ->
|
||||
# Settings don't exist, create them
|
||||
Mv.Membership.Setting
|
||||
|> Ash.Changeset.for_create(:create, %{club_name: default_club_name})
|
||||
|> Ash.create!(domain: Mv.Membership)
|
||||
end
|
||||
|
||||
IO.puts("✅ Seeds completed successfully!")
|
||||
IO.puts("📝 Created sample data:")
|
||||
IO.puts(" - Global settings: club_name = #{default_club_name}")
|
||||
IO.puts(" - Custom fields: 12 fields (String, Date, Boolean, Email, + 8 realistic fields)")
|
||||
IO.puts(" - Admin user: admin@mv.local (password: testpassword)")
|
||||
IO.puts(" - Sample members: Hans, Greta, Friedrich")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue