feat(booking): studio journal and instance inbox. Refs EventHub/EventHubFront#60
CI / test (push) Successful in 7m31s
CI / deploy-ift (push) Successful in 2m38s
CI / e2e-ift (push) Successful in 1m26s
CI / deploy-stage (push) Successful in 2m3s
CI / e2e-stage (push) Successful in 1m21s

This commit is contained in:
2026-08-14 11:13:01 +03:00
parent 520af23cc6
commit 2567585333
7 changed files with 155 additions and 10 deletions
+29
View File
@@ -48,6 +48,8 @@ logic_booking_test_() ->
{"List booking requests as owner", fun test_list_booking_requests_owner/0},
{"List booking requests as specialist", fun test_list_booking_requests_specialist/0},
{"List booking requests stranger empty", fun test_list_booking_requests_stranger/0},
{"Recurring pending in owner inbox via instance", fun test_recurring_pending_in_inbox/0},
{"Studio bookings include confirmed after confirm", fun test_studio_bookings_after_confirm/0},
{"Past pending expires on list", fun test_past_pending_expires_on_list/0},
{"Past pending excluded from booking requests", fun test_past_pending_excluded_from_requests/0},
{"Past pending confirm denied", fun test_past_pending_confirm_denied/0},
@@ -426,6 +428,33 @@ test_list_booking_requests_stranger() ->
{ok, _} = logic_booking:create_booking(ParticipantId, EventId),
{ok, []} = logic_booking:list_user_booking_requests(StrangerId).
test_recurring_pending_in_inbox() ->
OwnerId = create_test_user(user),
ParticipantId = create_test_user(user),
CalendarId = create_test_calendar(OwnerId, manual),
{MasterId, StartTime} = create_recurring_event(CalendarId),
Occ = add_days(StartTime, 7),
{ok, Booking} = logic_booking:create_booking(ParticipantId, MasterId, Occ),
{ok, Items} = logic_booking:list_user_booking_requests(OwnerId),
?assertEqual(1, length(Items)),
[{B, Event, owner}] = Items,
?assertEqual(Booking#booking.id, B#booking.id),
?assertEqual(true, Event#event.is_instance),
?assertEqual(Occ, Event#event.start_time).
test_studio_bookings_after_confirm() ->
OwnerId = create_test_user(user),
ParticipantId = create_test_user(user),
CalendarId = create_test_calendar(OwnerId, manual),
EventId = create_test_event(CalendarId),
{ok, Booking} = logic_booking:create_booking(ParticipantId, EventId),
{ok, _} = logic_booking:confirm_booking(OwnerId, Booking#booking.id, confirm),
{ok, []} = logic_booking:list_user_booking_requests(OwnerId),
{ok, Studio} = logic_booking:list_user_studio_bookings(OwnerId),
?assertEqual(1, length(Studio)),
[{B, _Event, owner}] = Studio,
?assertEqual(confirmed, B#booking.status).
test_past_pending_expires_on_list() ->
OwnerId = create_test_user(user),
ParticipantId = create_test_user(user),