Статистика для дашборда #7

This commit is contained in:
2026-04-28 21:31:22 +03:00
parent 967a024d0c
commit c87d56bb49
18 changed files with 210 additions and 167 deletions
+4 -1
View File
@@ -133,7 +133,7 @@ authenticate_admin_request(_Req, Email, Password) ->
case logic_auth:authenticate_admin(Email, Password) of
{ok, AdminMap} ->
Role = maps:get(role, AdminMap, <<"admin">>),
case admin_utils:is_admin(Role) of
case is_admin_role(Role) of
true ->
AdminId = maps:get(id, AdminMap),
Token = generate_admin_token(AdminId, Role),
@@ -143,6 +143,9 @@ authenticate_admin_request(_Req, Email, Password) ->
Error -> Error
end.
is_admin_role(Role) ->
lists:member(Role, [<<"admin">>, <<"superadmin">>, <<"moderator">>, <<"support">>]).
%% ========== REFRESH TOKEN ==========
-spec generate_refresh_token(UserId :: binary()) -> {binary(), calendar:datetime()}.