feat(backend): add external_urls to GraphQL

Available for :
- saveAdminSettings
- adminSettings
- config

For #1764
This commit is contained in:
Massedil
2025-07-01 19:38:16 +02:00
parent 04cf4efee4
commit 88b48f3350
5 changed files with 49 additions and 1 deletions

View File

@@ -159,6 +159,24 @@ defmodule Mobilizon.GraphQL.Schema.AdminType do
)
field(:instance_languages, list_of(:string), description: "The instance's languages")
field(:external_urls, list_of(:external_url),
description: "List of URL that will be shown to users"
)
end
object :external_url do
meta(:authorize, :all)
field(:label, non_null(:string), description: "A human-readable label for the external URL")
field(:url, non_null(:string), description: "The actual external URL")
field(:enabled, non_null(:boolean), description: "Whether the external URL is enabled")
end
input_object :external_url_input do
meta(:authorize, :administrator)
field(:label, non_null(:string))
field(:url, non_null(:string))
field(:enabled, non_null(:boolean))
end
@desc "The acceptable values for the instance's terms type"
@@ -475,6 +493,11 @@ defmodule Mobilizon.GraphQL.Schema.AdminType do
)
arg(:instance_languages, list_of(:string), description: "The instance's languages")
arg(:external_urls, list_of(:external_url_input),
description: "Array of external URLs with label, status, and id"
)
middleware(Rajska.QueryAuthorization, permit: :administrator)
resolve(&Admin.save_settings/3)
end