Stage 3.4

This commit is contained in:
2026-04-20 16:40:44 +03:00
parent 42a047a938
commit b24cbc97f3
25 changed files with 2520 additions and 123 deletions

View File

@@ -23,7 +23,8 @@ create_calendar(Req) ->
case Decoded of
#{<<"title">> := Title} ->
Description = maps:get(<<"description">>, Decoded, <<"">>),
case logic_calendar:create_calendar(UserId, Title, Description) of
Confirmation = parse_confirmation(maps:get(<<"confirmation">>, Decoded, <<"manual">>)),
case logic_calendar:create_calendar(UserId, Title, Description, Confirmation) of
{ok, Calendar} ->
Response = calendar_to_json(Calendar),
send_json(Req2, 201, Response);
@@ -45,6 +46,11 @@ create_calendar(Req) ->
send_error(Req1, Code, Message)
end.
parse_confirmation(<<"auto">>) -> auto;
parse_confirmation(<<"manual">>) -> manual;
parse_confirmation(#{<<"timeout">> := N}) when is_integer(N), N > 0 -> {timeout, N};
parse_confirmation(_) -> manual.
%% GET /v1/calendars - список календарей
list_calendars(Req) ->
case handler_auth:authenticate(Req) of