fix(member-export): split composite Name and Address into component columns on export

This commit is contained in:
Simon 2026-07-16 09:38:54 +02:00
parent a64835fe6d
commit 0a23d03d9d
3 changed files with 96 additions and 1 deletions

View file

@ -135,6 +135,20 @@ defmodule MvWeb.MemberLive.Index.FieldVisibility do
leading ++ rest
end
@doc """
The DB constituent columns the composite `:name` cell stands in for, in
canonical order. `:email` is a constituent only while it is folded into the
compact Member cell (`include_email?` true); otherwise it is its own column.
"""
@spec name_constituents(boolean()) :: [atom()]
def name_constituents(include_email?) do
if include_email?, do: @name_constituents, else: @name_constituents -- [:email]
end
@doc "The DB constituent columns the composite `:address` cell stands in for, in canonical order."
@spec address_constituents() :: [:street | :house_number | :postal_code | :city, ...]
def address_constituents, do: @address_constituents
# The email is a separate offered column except when it is folded into the
# compact Member cell (compact + include_email).
defp email_offered?(compact_member, include_email), do: not (compact_member and include_email)