Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add human_readable_name to get_access_restrictions #4517

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/sanbase/billing/plan/restrictions.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ defmodule Sanbase.Billing.Plan.Restrictions do
@type restriction :: %{
type: String.t(),
name: String.t(),
human_readable_name: String.t(),
internal_name: String.t(),
min_interval: String.t(),
is_accessible: boolean(),
Expand Down Expand Up @@ -96,6 +97,7 @@ defmodule Sanbase.Billing.Plan.Restrictions do
%{
type: type_str,
name: name_str,
human_readable_name: name_str,
is_accessible: false,
is_restricted: true,
restricted_from: nil,
Expand Down Expand Up @@ -171,7 +173,10 @@ defmodule Sanbase.Billing.Plan.Restrictions do
defp additional_data("metric", metric) do
case Sanbase.Metric.metadata(metric) do
{:ok, metadata} ->
{:ok, human_readable_name} = Sanbase.Metric.human_readable_name(metric)

%{
human_readable_name: human_readable_name,
min_interval: metadata.min_interval,
internal_name: metadata.internal_metric,
is_deprecated: metadata.is_deprecated,
Expand All @@ -189,7 +194,10 @@ defmodule Sanbase.Billing.Plan.Restrictions do
defp additional_data("signal", signal) do
case Sanbase.Signal.metadata(signal) do
{:ok, metadata} ->
{:ok, human_readable_name} = Sanbase.Signal.human_readable_name(signal)

%{
human_readable_name: human_readable_name,
min_interval: metadata.min_interval,
internal_name: metadata.internal_signal,
available_selectors: [],
Expand Down
1 change: 1 addition & 0 deletions lib/sanbase_web/graphql/schema/types/user_types.ex
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ defmodule SanbaseWeb.Graphql.UserTypes do
object :access_restriction do
field(:type, non_null(:string))
field(:name, non_null(:string))
field(:human_readable_name, non_null(:string))
field(:internal_name, non_null(:string))
field(:min_interval, :string)
field(:is_restricted, non_null(:boolean))
Expand Down
1 change: 1 addition & 0 deletions test/sanbase_web/plans/business_plans_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ defmodule SanbaseWeb.Plans.BusinessPlansTest do
getAccessRestrictions{
type
name
humanReadableName
minInterval
internalName
isRestricted
Expand Down
Loading