fix: owner event bookings list and paid plan durations from plan_to_months.
CI / test (push) Successful in 6m55s
CI / deploy-ift (push) Successful in 3m33s
CI / e2e-ift (push) Failing after 1m4s
CI / deploy-stage (push) Has been skipped
CI / e2e-stage (push) Has been skipped

Fixes EventHub/EventHubBack#51
Fixes EventHub/EventHubBack#52

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-21 20:18:49 +03:00
parent 7368adfb37
commit 5ac23219ca
6 changed files with 133 additions and 26 deletions
+28 -1
View File
@@ -2,7 +2,7 @@
-include_lib("eunit/include/eunit.hrl").
-include("records.hrl").
-define(TABLES, [user, calendar, event, booking]).
-define(TABLES, [user, calendar, event, booking, admin]).
setup() ->
eh_test_support:start_mnesia(),
@@ -29,6 +29,8 @@ logic_booking_test_() ->
{"Cancel booking by participant", fun test_cancel_booking/0},
{"Cancel booking access denied", fun test_cancel_access_denied/0},
{"List event bookings", fun test_list_event_bookings/0},
{"List event bookings as owner", fun test_list_event_bookings_owner/0},
{"List event bookings non-owner denied", fun test_list_event_bookings_non_owner/0},
{"List user bookings", fun test_list_user_bookings/0}
]}.
@@ -163,6 +165,31 @@ test_list_event_bookings() ->
{ok, Bookings} = logic_booking:list_event_bookings(EventId),
?assertEqual(2, length(Bookings)).
test_list_event_bookings_owner() ->
OwnerId = create_test_user(user),
Participant1Id = create_test_user(user),
Participant2Id = create_test_user(user),
CalendarId = create_test_calendar(OwnerId, manual),
EventId = create_test_event(CalendarId),
{ok, _} = logic_booking:create_booking(Participant1Id, EventId),
{ok, _} = logic_booking:create_booking(Participant2Id, EventId),
{ok, Bookings} = logic_booking:list_event_bookings(OwnerId, EventId),
?assertEqual(2, length(Bookings)).
test_list_event_bookings_non_owner() ->
OwnerId = create_test_user(user),
ParticipantId = create_test_user(user),
StrangerId = create_test_user(user),
CalendarId = create_test_calendar(OwnerId, manual),
EventId = create_test_event(CalendarId),
{ok, _} = logic_booking:create_booking(ParticipantId, EventId),
{error, access_denied} = logic_booking:list_event_bookings(StrangerId, EventId),
{error, access_denied} = logic_booking:list_event_bookings(ParticipantId, EventId).
test_list_user_bookings() ->
OwnerId = create_test_user(user),
ParticipantId = create_test_user(user),