Skip to content

Commit

Permalink
Fixing CR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Janusz Jakubiec authored and Janusz Jakubiec committed Jul 19, 2022
1 parent 5a9e88a commit a761316
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion priv/graphql/schemas/admin/admin_schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type AdminQuery{
metric: MetricAdminQuery
"Statistics"
stats: StatsAdminQuery
"GDPR"
"Personal data management according to GDPR"
gdpr: GdprAdminQuery
}

Expand Down
10 changes: 8 additions & 2 deletions src/gdpr_api.erl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@

-define(CMD_TIMEOUT, 300000).

-spec retrieve_all(jid:user(), jid:server(), Path :: binary()) -> ok | {error, Reason :: any()}.
-spec retrieve_all(jid:user(), jid:server(), Path :: binary()) ->
ok | {user_does_not_exist_error, Reason :: string()}.
retrieve_all(Username, Domain, ResultFilePath) ->
JID = jid:make(Username, Domain, <<>>),
receive
_ -> ok
after
9000 -> ok
end,
case user_exists(JID) of
true ->
DataFromModules = get_data_from_modules(JID),
Expand All @@ -39,7 +45,7 @@ retrieve_all(Username, Domain, ResultFilePath) ->
remove_tmp_dir(TmpDir),
ok;
false ->
{error, "User does not exist"}
{user_does_not_exist_error, "User does not exist"}
end.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down
3 changes: 1 addition & 2 deletions src/graphql/admin/mongoose_graphql_gdpr_admin_query.erl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ execute(_Ctx, gdpr, <<"retrievePersonalData">>, #{<<"username">> := User, <<"dom
<<"resultFilepath">> := FilePath}) ->
try gdpr_api:retrieve_all(User, Domain, FilePath) of
ok -> {ok, "Data retrieved"};
{error, String} -> make_error({user_does_not_exist_error, String},
#{user => User, domain => Domain})
Error -> make_error(Error, #{user => User, domain => Domain})
catch
_ -> make_error({internal_server_error, "Internal server error"},
#{user => User, domain => Domain, filePath => FilePath})
Expand Down

0 comments on commit a761316

Please sign in to comment.