1 |
|
-module(mongoose_graphql_stanza_admin_query). |
2 |
|
-behaviour(mongoose_graphql). |
3 |
|
|
4 |
|
-export([execute/4]). |
5 |
|
|
6 |
|
-ignore_xref([execute/4]). |
7 |
|
|
8 |
|
-include("../mongoose_graphql_types.hrl"). |
9 |
|
-include("mongoose_logger.hrl"). |
10 |
|
|
11 |
|
execute(_Ctx, _Obj, <<"getLastMessages">>, Args) -> |
12 |
:-( |
get_last_messages(Args). |
13 |
|
|
14 |
|
get_last_messages(#{<<"caller">> := Caller, <<"limit">> := Limit, |
15 |
|
<<"with">> := With, <<"before">> := Before}) |
16 |
|
when is_integer(Limit) -> |
17 |
:-( |
case mongoose_graphql_helper:check_user(Caller, true) of |
18 |
|
{ok, _HostType} -> |
19 |
:-( |
mongoose_stanza_helper:get_last_messages(Caller, Limit, With, Before); |
20 |
|
Error -> |
21 |
:-( |
Error |
22 |
|
end. |