1 |
|
-module(mongoose_graphql_vcard_admin_query). |
2 |
|
-behaviour(mongoose_graphql). |
3 |
|
|
4 |
|
-export([execute/4]). |
5 |
|
|
6 |
|
-import(mongoose_graphql_helper, [make_error/2]). |
7 |
|
|
8 |
|
-ignore_xref([execute/4]). |
9 |
|
|
10 |
|
-include("../mongoose_graphql_types.hrl"). |
11 |
|
-include("mongoose.hrl"). |
12 |
|
-include("jlib.hrl"). |
13 |
|
|
14 |
|
execute(_Ctx, vcard, <<"getVcard">>, #{<<"user">> := CallerJID}) -> |
15 |
16 |
case mod_vcard_api:get_vcard(CallerJID) of |
16 |
9 |
{ok, _} = Vcard -> Vcard; |
17 |
|
Error -> |
18 |
7 |
make_error(Error, #{user => jid:to_binary(CallerJID)}) |
19 |
|
end. |