1 |
|
-module(mongoose_graphql_inbox_admin_mutation). |
2 |
|
|
3 |
|
-behaviour(mongoose_graphql). |
4 |
|
|
5 |
|
-export([execute/4]). |
6 |
|
|
7 |
|
-import(mongoose_graphql_helper, [format_result/2, null_to_default/2]). |
8 |
|
|
9 |
|
-ignore_xref([execute/4]). |
10 |
|
|
11 |
|
execute(_Ctx, inbox, <<"flushUserBin">>, #{<<"user">> := UserJID, <<"days">> := Days}) -> |
12 |
12 |
Res = mod_inbox_api:flush_user_bin(UserJID, null_to_default(Days, 0)), |
13 |
12 |
format_result(Res, #{user => jid:to_binary(UserJID)}); |
14 |
|
execute(_Ctx, inbox, <<"flushDomainBin">>, #{<<"domain">> := Domain, <<"days">> := Days}) -> |
15 |
9 |
Res = mod_inbox_api:flush_domain_bin(Domain, null_to_default(Days, 0)), |
16 |
9 |
format_result(Res, #{domain => Domain}); |
17 |
|
execute(_Ctx, inbox, <<"flushGlobalBin">>, #{<<"hostType">> := HostType, <<"days">> := Days}) -> |
18 |
6 |
Res = mod_inbox_api:flush_global_bin(HostType, null_to_default(Days, 0)), |
19 |
6 |
format_result(Res, #{host_type => HostType}). |