feat(share): calendar_share invite/ACL for personal and commercial.
CI / test (push) Failing after 6m37s
CI / deploy-ift (push) Has been skipped
CI / e2e-ift (push) Has been skipped
CI / deploy-stage (push) Has been skipped
CI / e2e-stage (push) Has been skipped

Co-editor and deputy grants with mirror_to_default; personal out of search; list owned+shared. Refs EventHub/EventHubBack#73
This commit is contained in:
2026-08-15 23:20:11 +03:00
parent 00bf72e4d1
commit 331000a464
17 changed files with 1413 additions and 28 deletions
+16 -1
View File
@@ -168,7 +168,7 @@ list_calendars(Req) ->
{ok, UserId, Req1} ->
case logic_calendar:list_calendars(UserId) of
{ok, Calendars} ->
Response = [calendar_to_json(C) || C <- Calendars],
Response = [calendar_list_json(UserId, C) || C <- Calendars],
handler_utils:send_json(Req1, 200, Response);
{error, _} ->
handler_utils:send_error(Req1, 500, <<"Internal server error">>)
@@ -181,6 +181,21 @@ list_calendars(Req) ->
%%% Внутренние функции
%%%===================================================================
-spec calendar_list_json(binary(), #calendar{}) -> map().
calendar_list_json(UserId, #calendar{owner_id = UserId} = Calendar) ->
(calendar_to_json(Calendar))#{role => <<"owner">>};
calendar_list_json(UserId, Calendar) ->
Base = (calendar_to_json(Calendar))#{role => <<"shared">>},
case core_calendar_share:get(Calendar#calendar.id, UserId) of
{ok, Share} ->
Base#{
share_rights => Share#calendar_share.rights,
mirror_to_default => Share#calendar_share.mirror_to_default
};
{error, not_found} ->
Base
end.
-spec calendar_to_json(#calendar{}) -> map().
calendar_to_json(Calendar) ->
Base = handler_utils:calendar_to_json(Calendar),