Добавлены эндпойнты admin/v1/events и admin/v1/events/:id #20
This commit is contained in:
@@ -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) ->
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user