Skip to content

Commit

Permalink
Channel parameter de duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
h7ml committed Jun 25, 2021
1 parent 062276c commit 9222d9c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions apps/dgiot_bridge/src/handler/dgiot_rule_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ do_request(get_actions_id, #{<<"id">> := RuleID}, _Context, _Req) ->

do_request(get_resources, _Args, _Context, _Req) ->
{ok, #{data := Data} = Result} = emqx_rule_engine_api:list_resources(#{}, []),
{ok, Result#{data => Data ++ get_channel()}};
{ok, Result#{data => get_channel(Data)}};

%% OperationId:post_rule_resource
do_request(post_resources, Params, _Context, _Req) ->
Expand Down Expand Up @@ -201,7 +201,8 @@ do_request(_OperationId, _Args, _Context, _Req) ->
%% {error, Reason1}
%% end.

get_channel() ->
get_channel(Data) ->
?LOG(error, "~p", [Data]),
case dgiot_parse:query_object(<<"Channel">>, #{<<"keys">> => [<<"name">>]}) of
{ok, #{<<"results">> := Results}} when length(Results) > 0 ->
lists:foldl(fun(#{<<"objectId">> := ChannelId,<<"name">> := Name}, Acc) ->
Expand Down

0 comments on commit 9222d9c

Please sign in to comment.