Stage 8
This commit is contained in:
@@ -11,11 +11,24 @@ create_calendar(UserId, Title, Description) ->
|
||||
|
||||
%% Создание календаря с указанной политикой подтверждения
|
||||
create_calendar(UserId, Title, Description, Confirmation) ->
|
||||
Type = personal, % По умолчанию
|
||||
create_calendar(UserId, Title, Description, Confirmation, Type).
|
||||
|
||||
create_calendar(UserId, Title, Description, Confirmation, Type) ->
|
||||
case core_user:get_by_id(UserId) of
|
||||
{ok, User} ->
|
||||
case User#user.status of
|
||||
active ->
|
||||
core_calendar:create(UserId, Title, Description, Confirmation);
|
||||
% Проверяем подписку для commercial календарей
|
||||
case Type of
|
||||
commercial ->
|
||||
case logic_subscription:can_create_commercial_calendar(UserId) of
|
||||
true -> ok;
|
||||
false -> {error, subscription_required}
|
||||
end;
|
||||
personal -> ok
|
||||
end,
|
||||
core_calendar:create(UserId, Title, Description, Confirmation, Type);
|
||||
_ ->
|
||||
{error, user_inactive}
|
||||
end;
|
||||
|
||||
Reference in New Issue
Block a user