Skip to content

Commit

Permalink
Removing unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
Janusz Jakubiec authored and Janusz Jakubiec committed Nov 3, 2022
1 parent bf8983e commit bda362b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
3 changes: 0 additions & 3 deletions src/graphql/directive/mongoose_graphql_directive_use.erl
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ handle_directive(#directive{id = <<"use">>, args = Args}, #schema_field{} = Fiel
Field;
{_, _} ->
Fun = resolve_not_loaded_fun(UnloadedModules, UnloadedServices),
io:format("tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt\n\n\n"),
io:format("~p\n", [Field#schema_field{resolve = Fun}]),
io:format("tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt\n\n\n"),
Field#schema_field{resolve = Fun}
end;
{error, not_found} ->
Expand Down
1 change: 0 additions & 1 deletion src/graphql/mongoose_graphql.erl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
-export([init/0,
get_endpoint/1,
create_endpoint/3,
graphql_parse/1,
execute/2,
execute/3,
execute_cli/3]).
Expand Down
18 changes: 2 additions & 16 deletions src/graphql/mongoose_graphql_cowboy_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
-ignore_xref([from_json/2, to_html/2, to_json/2]).

-include("mongoose_config_spec.hrl").
-include_lib("graphql/src/graphql_internal.hrl").
-include_lib("graphql/src/graphql_schema.hrl").

%% mongoose_http_handler callbacks

Expand Down Expand Up @@ -186,24 +184,12 @@ run_request(#{} = ReqCtx, Req, #{schema_endpoint := EpName,
{ok, Response} ->
ResponseBody = mongoose_graphql_response:term_to_json(Response),
Req2 = cowboy_req:set_resp_body(ResponseBody, Req),
cowboy_req:reply(200, Req2);
cowboy_req:reply(200, Req2),
{stop, Reply, State};
{error, Reason} ->
reply_error(Reason, Req, State)
end.

retrieve_category_from_ctx(Ctx, _) ->
#{document := Doc} = Ctx,
try mongoose_graphql:graphql_parse(Doc) of
{ok, Document} ->
[Parsed] = Document#document.definitions,
[Field] = Parsed#op.selection_set,
{name, _, Category} = Field#field.id,
Category
catch
Error ->
Error
end.

gather(Req) ->
{ok, Body, Req2} = cowboy_req:read_body(Req),
Bindings = cowboy_req:bindings(Req2),
Expand Down

0 comments on commit bda362b

Please sign in to comment.