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