fix
This commit is contained in:
parent
138ce5c20a
commit
87c3e46289
@ -13,11 +13,11 @@
|
|||||||
%% API
|
%% API
|
||||||
-export([get_all_endpoints/0, get_endpoint_by_id/1]).
|
-export([get_all_endpoints/0, get_endpoint_by_id/1]).
|
||||||
|
|
||||||
-spec get_all_endpoints() -> EndpointIds :: [integer()].
|
-spec get_all_endpoints() -> [Endpoint :: map()].
|
||||||
get_all_endpoints() ->
|
get_all_endpoints() ->
|
||||||
case mysql_pool:get_all(mysql_iot, <<"SELECT id FROM endpoint where status = 1">>) of
|
case mysql_pool:get_all(mysql_iot, <<"SELECT * FROM endpoint where status = 1">>) of
|
||||||
{ok, Endpoints} ->
|
{ok, Endpoints} ->
|
||||||
lists:map(fun(#{<<"id">> := Id}) -> Id end, Endpoints);
|
Endpoints;
|
||||||
{error, _} ->
|
{error, _} ->
|
||||||
[]
|
[]
|
||||||
end.
|
end.
|
||||||
@ -29,7 +29,9 @@ start_link() ->
|
|||||||
%% modules => modules()} % optional
|
%% modules => modules()} % optional
|
||||||
init([]) ->
|
init([]) ->
|
||||||
SupFlags = #{strategy => one_for_one, intensity => 1000, period => 3600},
|
SupFlags = #{strategy => one_for_one, intensity => 1000, period => 3600},
|
||||||
ChildSpecs = [],
|
{ok, Endpoints} = endpoint_bo:get_all_endpoints(),
|
||||||
|
ChildSpecs = lists:map(fun child_spec/1, Endpoints),
|
||||||
|
|
||||||
{ok, {SupFlags, ChildSpecs}}.
|
{ok, {SupFlags, ChildSpecs}}.
|
||||||
|
|
||||||
%% internal functions
|
%% internal functions
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user