Skip to content

Commit 542ccf9

Browse files
authored
Merge branch 'master' into add-bullish-bearish-sentiment-ratios
2 parents 9e98805 + 030106c commit 542ccf9

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

lib/sanbase_web/graphql/resolvers/promoter_resolver.ex

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ defmodule SanbaseWeb.Graphql.Resolvers.PromoterResolver do
1919

2020
# Note: Adding new field to extract should be also reflected by adding it in promoter_types.ex
2121
defp extract_and_atomize_needed_fields({:ok, promoter}) do
22+
auth_token = promoter["auth_token"]
23+
2224
promoter =
2325
promoter
2426
|> Map.take([
@@ -47,6 +49,13 @@ defmodule SanbaseWeb.Graphql.Resolvers.PromoterResolver do
4749
end)
4850
|> Sanbase.MapUtils.atomize_keys()
4951

52+
promoter =
53+
promoter
54+
|> Map.put(
55+
:dashboard_url,
56+
"https://santiment.firstpromoter.com/view_dashboard_as?at=#{auth_token}"
57+
)
58+
5059
{:ok, promoter}
5160
end
5261
end

lib/sanbase_web/graphql/schema/types/promoter_types.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ defmodule SanbaseWeb.Graphql.Schema.PromoterTypes do
77
field(:current_balance, :integer)
88
field(:paid_balance, :integer)
99
field(:promotions, list_of(:promotion))
10+
field(:dashboard_url, :string)
1011
end
1112

1213
object :promotion do

test/sanbase_web/graphql/promoter/promoter_api_test.exs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ defmodule SanbaseWeb.Graphql.PromoterApiTest do
5858
promotion = promoter["promotions"] |> hd
5959

6060
assert promoter["email"] == resp["email"]
61+
62+
assert promoter["dashboardUrl"] ==
63+
"https://santiment.firstpromoter.com/view_dashboard_as?at=#{resp["auth_token"]}"
64+
6165
assert promotion["visitorsCount"] == resp["promotions"] |> hd |> Map.get("visitors_count")
6266
end)
6367
end
@@ -86,6 +90,7 @@ defmodule SanbaseWeb.Graphql.PromoterApiTest do
8690
currentBalance
8791
earningsBalance
8892
paidBalance
93+
dashboardUrl
8994
promotions {
9095
refId
9196
referralLink
@@ -112,6 +117,7 @@ defmodule SanbaseWeb.Graphql.PromoterApiTest do
112117
currentBalance
113118
earningsBalance
114119
paidBalance
120+
dashboardUrl
115121
promotions {
116122
refId
117123
referralLink

0 commit comments

Comments
 (0)