Расширена общая статистика по дням: Отзывы, Календари, Жалобы, Тикеты, Подписки #22

This commit is contained in:
2026-05-27 22:40:03 +03:00
parent 4444461ee3
commit 2dac5e5102
9 changed files with 250 additions and 39 deletions
+60 -12
View File
@@ -35,10 +35,7 @@ trails() ->
responses => #{
200 => #{
description => <<"Statistics object">>,
content => #{<<"application/json">> => #{schema => #{
type => object,
properties => stats_schema()
}}}
content => #{<<"application/json">> => #{schema => stats_schema()}}
},
403 => #{description => <<"Admin access required">>}
}
@@ -47,14 +44,65 @@ trails() ->
stats_schema() ->
#{
<<"users">> => #{type => integer, description => <<"Total number of users">>},
<<"events">> => #{type => integer},
<<"reviews">> => #{type => integer},
<<"calendars">> => #{type => integer},
<<"reports">> => #{type => integer},
<<"tickets">> => #{type => integer},
<<"subscriptions">> => #{type => integer},
<<"active_subscriptions">> => #{type => integer}
type => object,
properties => #{
<<"users_total">> => #{type => integer, description => <<"Total number of users">>},
<<"events_total">> => #{type => integer, description => <<"Total number of events">>},
<<"reviews_total">> => #{type => integer, description => <<"Total number of reviews">>},
<<"calendars_total">> => #{type => integer, description => <<"Total number of calendars">>},
<<"reports_total">> => #{type => integer, description => <<"Total number of reports">>},
<<"tickets_total">> => #{type => integer, description => <<"Total number of tickets">>},
<<"tickets_open">> => #{type => integer, description => <<"Number of open tickets">>},
<<"subscriptions_total">> => #{type => integer, description => <<"Total number of subscriptions">>},
<<"active_subscriptions">> => #{type => integer, description => <<"Number of active subscriptions">>},
<<"pending_users_total">> => #{type => integer, description => <<"Number of users awaiting email verification">>},
<<"avg_ticket_resolution_h">> => #{type => number, format => float, description => <<"Average ticket resolution time in hours">>},
<<"registrations_by_day">> => #{
type => array,
items => #{type => object, properties => #{<<"date">> => #{type => string}, <<"count">> => #{type => integer}}},
description => <<"Daily user registrations">>
},
<<"events_by_day">> => #{
type => array,
items => #{type => object, properties => #{<<"date">> => #{type => string}, <<"count">> => #{type => integer}}},
description => <<"Daily event creations">>
},
<<"reviews_by_day">> => #{
type => array,
items => #{type => object, properties => #{<<"date">> => #{type => string}, <<"count">> => #{type => integer}}},
description => <<"Daily review creations">>
},
<<"calendars_by_day">> => #{
type => array,
items => #{type => object, properties => #{<<"date">> => #{type => string}, <<"count">> => #{type => integer}}},
description => <<"Daily calendar creations">>
},
<<"reports_by_day">> => #{
type => array,
items => #{type => object, properties => #{<<"date">> => #{type => string}, <<"count">> => #{type => integer}}},
description => <<"Daily report creations">>
},
<<"tickets_by_day">> => #{
type => array,
items => #{type => object, properties => #{<<"date">> => #{type => string}, <<"count">> => #{type => integer}}},
description => <<"Daily ticket creations">>
},
<<"subscriptions_by_day">> => #{
type => array,
items => #{type => object, properties => #{<<"date">> => #{type => string}, <<"count">> => #{type => integer}}},
description => <<"Daily subscription creations">>
},
<<"pending_users_by_day">> => #{
type => array,
items => #{type => object, properties => #{<<"date">> => #{type => string}, <<"count">> => #{type => integer}}},
description => <<"Daily pending user registrations">>
},
<<"admin_activity">> => #{
type => array,
items => #{type => object},
description => <<"Recent admin actions (superadmin only)">>
}
}
}.
%%% Internal functions