Добавлены эндпойнты admin/v1/events и admin/v1/events/:id #20

This commit is contained in:
2026-05-08 19:02:35 +03:00
parent 393cf00631
commit 1132341b92
9 changed files with 456 additions and 3 deletions
+5
View File
@@ -6,6 +6,7 @@
-export([generate_id/0]).
-export([count_events/0, count_events_by_date/2]).
-export([freeze/2, unfreeze/2]).
-export([list_all/0]).
%% Создание одиночного события
create(CalendarId, Title, StartTime, Duration) ->
@@ -172,6 +173,10 @@ delete(Id) ->
count_events() ->
mnesia:table_info(event, size).
list_all() ->
Match = #event{status = active, is_instance = false, _ = '_'},
mnesia:dirty_match_object(Match).
count_events_by_date(From, To) ->
All = mnesia:dirty_match_object(#event{_ = '_'}),
Filtered = lists:filter(fun(E) ->
+1 -1
View File
@@ -48,7 +48,7 @@ stats() ->
%% ── новые функции ──────────────────────────────────────
create_ticket(Data) ->
Id = base64:encode(crypto:strong_rand_bytes(9)),
Id = base64:encode(crypto:strong_rand_bytes(9), #{mode => urlsafe, padding => false}),
Now = calendar:universal_time(),
Ticket = #ticket{
id = Id,