Skip to content

Commit

Permalink
block new segments if prod
Browse files Browse the repository at this point in the history
  • Loading branch information
marceloarocha committed Jun 4, 2024
1 parent 27b5ccc commit 4c30153
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion services/admin/segment_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from models.main import *
from models.appendix import *
from models.segment import *
from models.enums import RoleEnum
from models.enums import RoleEnum, IntegrationStatusEnum
from services.admin import integration_status_service

from exception.validation_error import ValidationError

Expand All @@ -26,6 +27,16 @@ def upsert_segment(id_segment, description, active, user):
status.HTTP_400_BAD_REQUEST,
)
else:
if (
integration_status_service.get_integration_status(user.schema)
== IntegrationStatusEnum.PRODUCTION.value
):
raise ValidationError(
"O processo de criação de segmentos foi desativado para integrações em Produção. Solicite criação manual.",
"errors.businessRules",
status.HTTP_400_BAD_REQUEST,
)

segment = Segment()

segment.description = description
Expand Down

0 comments on commit 4c30153

Please sign in to comment.