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
+5 -2
View File
@@ -24,8 +24,11 @@ test() ->
ct:pal("=== Admin Moderation Tests ==="),
Token = api_test_runner:get_admin_token(),
UserToken = api_test_runner:get_user_token(),
% Создаём календарь и событие
CalId = api_test_runner:create_calendar(UserToken, #{title => <<"ModTestCal">>}),
% Создаём commercial-календарь и событие (бронь только на commercial)
CalId = api_test_runner:create_calendar(UserToken, #{
title => <<"ModTestCal">>,
type => <<"commercial">>,
confirmation => <<"manual">>}),
EventId = api_test_runner:create_event(UserToken, CalId, #{
title => <<"Event to moderate">>,
start_time => api_test_runner:future_date(),
+5 -2
View File
@@ -28,8 +28,11 @@ test() ->
ct:pal("=== Admin Reviews Tests ==="),
Token = api_test_runner:get_admin_token(),
UserToken = api_test_runner:get_user_token(),
%% Создаём тестовые данные: календарь, событие
CalId = api_test_runner:create_calendar(UserToken, #{title => <<"ReviewsTestCal">>}),
%% Создаём тестовые данные: commercial-календарь (бронь только на нём), событие
CalId = api_test_runner:create_calendar(UserToken, #{
title => <<"ReviewsTestCal">>,
type => <<"commercial">>,
confirmation => <<"manual">>}),
EventId = api_test_runner:create_event(UserToken, CalId, #{
title => <<"Event for review testing">>,
start_time => api_test_runner:future_date(),
+10 -5
View File
@@ -40,22 +40,27 @@ test() ->
% Создаём тестовые данные для ненулевой статистики
UserToken = api_test_runner:get_user_token(),
CalId = api_test_runner:create_calendar(UserToken, #{title => <<"StatsCal">>}),
ParticipantEmail = api_test_runner:unique_email(<<"statspart">>),
ParticipantToken = api_test_runner:register_and_login(ParticipantEmail, <<"pass">>),
CalId = api_test_runner:create_calendar(UserToken, #{
title => <<"StatsCal">>,
type => <<"commercial">>,
confirmation => <<"manual">>}),
EventId = api_test_runner:create_event(UserToken, CalId, #{
title => <<"Stats Event">>,
start_time => api_test_runner:future_date(),
duration => 60
}),
% Бронируем и подтверждаем, чтобы можно было оставить отзыв
% Бронируем участником (не владельцем) и подтверждаем, чтобы можно было оставить отзыв
#{<<"id">> := BookingId} = api_test_runner:client_post(
<<"/v1/events/", EventId/binary, "/bookings">>, UserToken, #{}),
<<"/v1/events/", EventId/binary, "/bookings">>, ParticipantToken, #{}),
api_test_runner:client_put(<<"/v1/bookings/", BookingId/binary>>, UserToken,
#{action => <<"confirm">>}),
% Оставляем отзыв
api_test_runner:client_post(<<"/v1/reviews">>, UserToken,
api_test_runner:client_post(<<"/v1/reviews">>, ParticipantToken,
#{target_type => <<"event">>, target_id => EventId, rating => 5, comment => <<"Great!">>}),
% Жалоба
api_test_runner:client_post(<<"/v1/reports">>, UserToken,
api_test_runner:client_post(<<"/v1/reports">>, ParticipantToken,
#{<<"target_type">> => <<"event">>, <<"target_id">> => EventId, <<"reason">> => <<"Test">>}),
% Подписка
SubUserToken = api_test_runner:get_user_token(),
+2 -1
View File
@@ -91,7 +91,8 @@ test_report_on_review(Admin) ->
<<"report_threshold">> => 3
}),
Owner = api_test_runner:get_user_token(),
CalId = api_test_runner:create_calendar(Owner, #{title => <<"RevRepCal">>}),
CalId = api_test_runner:create_calendar(Owner, #{
title => <<"RevRepCal">>, type => <<"commercial">>, confirmation => <<"manual">>}),
#{<<"id">> := EventId} = api_test_runner:client_post(
<<"/v1/calendars/", CalId/binary, "/events">>, Owner,
#{title => <<"Event for review report">>,
+5 -1
View File
@@ -31,7 +31,11 @@ test() ->
ParticipantToken = api_test_runner:register_and_login(ParticipantEmail, <<"pass">>),
% Создаём календарь и событие
CalId = api_test_runner:create_calendar(OwnerToken, #{title => <<"BookingTest">>}),
CalId = api_test_runner:create_calendar(OwnerToken, #{
title => <<"BookingTest">>,
type => <<"commercial">>,
confirmation => <<"manual">>
}),
#{<<"id">> := EventId} = api_test_runner:client_post(
<<"/v1/calendars/", CalId/binary, "/events">>, OwnerToken,
#{title => <<"Event to book">>,
+5 -1
View File
@@ -27,7 +27,11 @@ test() ->
ParticipantToken = api_test_runner:register_and_login(ParticipantEmail, <<"pass">>),
% Создаём календарь и событие
CalId = api_test_runner:create_calendar(OwnerToken, #{title => <<"MyBookTest">>}),
CalId = api_test_runner:create_calendar(OwnerToken, #{
title => <<"MyBookTest">>,
type => <<"commercial">>,
confirmation => <<"manual">>
}),
#{<<"id">> := EventId} = api_test_runner:client_post(
<<"/v1/calendars/", CalId/binary, "/events">>, OwnerToken,
#{title => <<"Event for my booking">>,
+2 -1
View File
@@ -27,7 +27,8 @@ test() ->
ParticipantToken = api_test_runner:register_and_login(ParticipantEmail, <<"pass">>),
% Создаём календарь и событие
CalId = api_test_runner:create_calendar(OwnerToken, #{title => <<"MyRevTest">>}),
CalId = api_test_runner:create_calendar(OwnerToken, #{
title => <<"MyRevTest">>, type => <<"commercial">>, confirmation => <<"manual">>}),
#{<<"id">> := EventId} = api_test_runner:client_post(
<<"/v1/calendars/", CalId/binary, "/events">>, OwnerToken,
#{title => <<"Event for my review">>,
+2 -1
View File
@@ -34,7 +34,8 @@ test() ->
StrangerToken = api_test_runner:register_and_login(StrangerEmail, <<"pass">>),
% Создаём календарь, событие, бронирование и отзыв
CalId = api_test_runner:create_calendar(OwnerToken, #{title => <<"RevById">>}),
CalId = api_test_runner:create_calendar(OwnerToken, #{
title => <<"RevById">>, type => <<"commercial">>, confirmation => <<"manual">>}),
#{<<"id">> := EventId} = api_test_runner:client_post(
<<"/v1/calendars/", CalId/binary, "/events">>, OwnerToken,
#{title => <<"Event for review">>,
+2 -1
View File
@@ -22,7 +22,8 @@ test() ->
OtherEmail = api_test_runner:unique_email(<<"rvother">>),
OtherToken = api_test_runner:register_and_login(OtherEmail, <<"pass">>),
CalId = api_test_runner:create_calendar(OwnerToken, #{title => <<"VoteCal">>}),
CalId = api_test_runner:create_calendar(OwnerToken, #{
title => <<"VoteCal">>, type => <<"commercial">>, confirmation => <<"manual">>}),
#{<<"id">> := EventId} = api_test_runner:client_post(
<<"/v1/calendars/", CalId/binary, "/events">>, OwnerToken,
#{title => <<"Event for votes">>,
+5 -1
View File
@@ -31,7 +31,11 @@ test() ->
StrangerToken = api_test_runner:register_and_login(StrangerEmail, <<"pass">>),
% Создаём календарь и событие
CalId = api_test_runner:create_calendar(OwnerToken, #{title => <<"ReviewTest">>}),
CalId = api_test_runner:create_calendar(OwnerToken, #{
title => <<"ReviewTest">>,
type => <<"commercial">>,
confirmation => <<"manual">>
}),
#{<<"id">> := EventId} = api_test_runner:client_post(
<<"/v1/calendars/", CalId/binary, "/events">>, OwnerToken,
#{title => <<"Event for review">>,