Add Vereinfacht app URL setting and contact view URL

- Setting attribute vereinfacht_app_url, migration, .env.example
- Config: vereinfacht_app_url() from env/setting or derived from API URL
- Contact view URL uses app URL with /en/admin/finances/contacts/{id}
- Global settings: App URL field, read-only when VEREINFACHT_APP_URL set
- Tests: update contact view URL expectations
This commit is contained in:
Moritz 2026-02-23 19:21:09 +01:00
parent 7db609deec
commit 9d3c72acff
Signed by: moritz
GPG key ID: 1020A035E5DD0824
6 changed files with 98 additions and 11 deletions

View file

@ -39,14 +39,23 @@ defmodule Mv.ConfigVereinfachtTest do
assert Mv.Config.vereinfacht_contact_view_url("123") == nil
end
test "returns URL when API URL is set" do
test "returns app contact view URL when API URL is set (derived app URL)" do
set_vereinfacht_env("VEREINFACHT_API_URL", "https://api.example.com/api/v1")
assert Mv.Config.vereinfacht_contact_view_url("42") ==
"https://api.example.com/api/v1/finance-contacts/42"
"https://app.example.com/en/admin/finances/contacts/42"
after
clear_vereinfacht_env()
end
test "returns app contact view URL when VEREINFACHT_APP_URL is set" do
set_vereinfacht_env("VEREINFACHT_APP_URL", "https://app.verein.visuel.dev")
assert Mv.Config.vereinfacht_contact_view_url("abc") ==
"https://app.verein.visuel.dev/en/admin/finances/contacts/abc"
after
System.delete_env("VEREINFACHT_APP_URL")
end
end
defp set_vereinfacht_env(key, value) do