Stage 10 final

This commit is contained in:
2026-04-22 23:15:20 +03:00
parent e3a08cfa04
commit 081dcf9588
85 changed files with 2116 additions and 160 deletions

View File

@@ -16,7 +16,7 @@ handle(Req, _Opts) ->
%% POST /v1/tickets - сообщить об ошибке (доступно всем)
report_error(Req) ->
case handler_auth:authenticate(Req) of
{ok, UserId, Req1} ->
{ok, _UserId, Req1} ->
{ok, Body, Req2} = cowboy_req:read_body(Req1),
try jsx:decode(Body, [return_maps]) of
Decoded when is_map(Decoded) ->
@@ -111,8 +111,10 @@ datetime_to_iso8601({{Year, Month, Day}, {Hour, Minute, Second}}) ->
send_json(Req, Status, Data) ->
Body = jsx:encode(Data),
cowboy_req:reply(Status, #{<<"content-type">> => <<"application/json">>}, Body, Req).
cowboy_req:reply(Status, #{<<"content-type">> => <<"application/json">>}, Body, Req),
{ok, Body, []}.
send_error(Req, Status, Message) ->
Body = jsx:encode(#{error => Message}),
cowboy_req:reply(Status, #{<<"content-type">> => <<"application/json">>}, Body, Req).
cowboy_req:reply(Status, #{<<"content-type">> => <<"application/json">>}, Body, Req),
{ok, Body, []}.