Рефакторинг обработчиков. Финальное тестирование #21

This commit is contained in:
2026-05-18 14:37:59 +03:00
parent 40806df62a
commit 3abf5c94ee
21 changed files with 630 additions and 89 deletions
+74
View File
@@ -0,0 +1,74 @@
-module(eventhub_trails).
-export([admin/0, user/0, all/0]).
admin() ->
Modules = [
% ================== БАЗОВЫЕ ==================
admin_handler_health,
admin_handler_stats,
admin_handler_login,
% ================== ПОЛЬЗОВАТЕЛИ ==================
admin_handler_users,
admin_handler_user_by_id,
% ================== СОБЫТИЯ ==================
admin_handler_events,
admin_handler_event_by_id,
% ================== ОТЧЁТЫ ==================
admin_handler_reports,
admin_handler_report_by_id,
% ================== ОТЗЫВЫ ==================
admin_handler_reviews,
admin_handler_reviews_by_id,
% ================== БАН-СЛОВА ==================
admin_handler_banned_words,
% ================== ТИКЕТЫ ==================
admin_handler_ticket_stats,
admin_handler_ticket_by_id,
admin_handler_tickets,
% ================== ПОДПИСКИ ==================
admin_handler_subscriptions,
admin_handler_subscriptions_by_id,
% ================== МОДЕРАЦИЯ (общий маршрут) ==================
admin_handler_moderation,
% ================== Управление ролями (только для superadmin) ==================
admin_handler_me,
admin_handler_admins,
admin_handler_audit
],
lists:flatmap(fun trails_from_module/1, Modules).
user() ->
Modules = [
handler_health,
handler_register,
handler_login,
handler_refresh,
handler_booking_by_id,
handler_bookings,
handler_calendar_by_id,
handler_calendar_view,
handler_calendars,
handler_event_by_id,
handler_event_occurrences,
handler_events,
handler_reports,
handler_review_by_id,
handler_reviews,
handler_search,
handler_subscription,
handler_ticket_by_id,
handler_tickets,
handler_user_bookings,
handler_user_me,
handler_user_reviews
],
lists:flatmap(fun trails_from_module/1, Modules).
all() ->
admin() ++ user().
trails_from_module(Module) ->
try Module:trails() of
Trails when is_list(Trails) -> Trails
catch error:undef -> []
end.