Implement commercial calendars: booking_open, specialists, expire without type downgrade.
CI / test (push) Successful in 6m44s
CI / deploy-ift (push) Successful in 4m2s
CI / e2e-ift (push) Successful in 1m25s
CI / deploy-stage (push) Successful in 2m25s
CI / e2e-stage (push) Successful in 1m12s

Refs EventHub/EventHubBack#54
This commit is contained in:
2026-07-22 16:12:52 +03:00
parent fdb08eb453
commit af5f506866
35 changed files with 978 additions and 207 deletions
+7 -1
View File
@@ -139,9 +139,13 @@ update_calendar(Req) ->
Updates = convert_calendar_fields(Updates0),
case logic_calendar:update_calendar(UserId, CalendarId, Updates) of
{ok, Calendar} ->
handler_utils:send_json(Req2, 200, handler_utils:calendar_to_json(Calendar));
Json0 = handler_utils:calendar_to_json(Calendar),
Following = logic_calendar_follow:is_following(UserId, CalendarId),
handler_utils:send_json(Req2, 200, Json0#{following => Following});
{error, access_denied} ->
handler_utils:send_error(Req2, 403, <<"Access denied">>);
{error, subscription_required} ->
handler_utils:send_error(Req2, 402, <<"Subscription required for commercial calendar">>);
{error, not_found} ->
handler_utils:send_error(Req2, 404, <<"Calendar not found">>);
{error, _} ->
@@ -182,6 +186,8 @@ convert_calendar_fields(Updates) ->
-spec convert_field({binary(), term()}) -> {atom(), term()}.
convert_field({<<"title">>, Val}) -> {title, Val};
convert_field({<<"description">>, Val}) -> {description, Val};
convert_field({<<"type">>, <<"personal">>}) -> {type, personal};
convert_field({<<"type">>, <<"commercial">>}) -> {type, commercial};
convert_field({<<"type">>, Val}) -> {type, Val};
convert_field({<<"confirmation">>, <<"auto">>}) -> {confirmation, auto};
convert_field({<<"confirmation">>, <<"manual">>}) -> {confirmation, manual};