1 |
|
-module(mongoose_graphql_private_user_mutation). |
2 |
|
-behaviour(mongoose_graphql). |
3 |
|
|
4 |
|
-export([execute/4]). |
5 |
|
|
6 |
|
-ignore_xref([execute/4]). |
7 |
|
|
8 |
|
-include("../mongoose_graphql_types.hrl"). |
9 |
|
|
10 |
|
-import(mongoose_graphql_helper, [make_error/2, format_result/2]). |
11 |
|
|
12 |
|
execute(#{user := CallerJID}, _Obj, <<"setPrivate">>, #{<<"elementString">> := Element}) -> |
13 |
1 |
case mod_private_api:private_set(CallerJID, Element) of |
14 |
1 |
{ok, _} = Result -> Result; |
15 |
:-( |
Error -> make_error(Error, #{user => jid:to_binary(CallerJID), |
16 |
|
element => exml:to_binary(Element)}) |
17 |
|
end. |