fix(test): ensure calendar_share table in ACL-related eunit suites.
CI / test (push) Failing after 6m13s
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

Harden core_calendar_share get/list when table missing. Refs EventHub/EventHubBack#73
This commit is contained in:
2026-08-15 23:48:12 +03:00
parent 331000a464
commit fcb737eb47
8 changed files with 28 additions and 9 deletions
+16 -3
View File
@@ -41,18 +41,31 @@ upsert(CalendarId, UserId, Rights, Mirror) ->
-spec get(CalendarId :: binary(), UserId :: binary()) ->
{ok, #calendar_share{}} | {error, not_found}.
get(CalendarId, UserId) ->
case find_dirty(CalendarId, UserId) of
try find_dirty(CalendarId, UserId) of
[Rec] -> {ok, Rec};
[] -> {error, not_found}
catch
exit:{aborted, {no_exists, _}} -> {error, not_found};
error:_ -> {error, not_found}
end.
-spec list_by_calendar(CalendarId :: binary()) -> [#calendar_share{}].
list_by_calendar(CalendarId) ->
mnesia:dirty_match_object(#calendar_share{calendar_id = CalendarId, _ = '_'}).
try
mnesia:dirty_match_object(#calendar_share{calendar_id = CalendarId, _ = '_'})
catch
exit:{aborted, {no_exists, _}} -> [];
error:_ -> []
end.
-spec list_by_user(UserId :: binary()) -> [#calendar_share{}].
list_by_user(UserId) ->
mnesia:dirty_match_object(#calendar_share{user_id = UserId, _ = '_'}).
try
mnesia:dirty_match_object(#calendar_share{user_id = UserId, _ = '_'})
catch
exit:{aborted, {no_exists, _}} -> [];
error:_ -> []
end.
-spec delete(CalendarId :: binary(), UserId :: binary()) -> ok | {error, not_found | term()}.
delete(CalendarId, UserId) ->