1 |
|
-module(mongoose_graphql_last_user_query). |
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, null_to_default/2]). |
11 |
|
|
12 |
|
-type last_info() :: mongoose_graphql_last_helper:last_info(). |
13 |
|
-type args() :: mongoose_graphql:args(). |
14 |
|
-type ctx() :: mongoose_graphql:context(). |
15 |
|
|
16 |
|
execute(Ctx, last, <<"getLast">>, Args) -> |
17 |
:-( |
get_last(Ctx, Args). |
18 |
|
|
19 |
|
-spec get_last(ctx(), args()) -> {ok, last_info()} | {error, resolver_error()}. |
20 |
|
get_last(#{user := UserJID}, #{<<"user">> := JID}) -> |
21 |
:-( |
mongoose_graphql_last_helper:get_last(null_to_default(JID, UserJID)). |