Skip to content

Commit

Permalink
refactor: standardize timezone handling in CommerceSerializer
Browse files Browse the repository at this point in the history
- Removed the TimezoneField from CommerceSerializer and replaced it with a static value "America/Sao_Paulo" for the timezone attribute.
- Updated the project creation logic to consistently use the static timezone value, ensuring uniformity across commerce-related instances.
  • Loading branch information
ericosta-dev committed Dec 4, 2024
1 parent befeebf commit d27ad7e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions connect/api/v2/commerce/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from rest_framework import serializers
from connect.celery import app as celery_app

from connect.api.v1.fields import TimezoneField
from connect.internals.event_driven.producer.rabbitmq_publisher import RabbitmqPublisher
from connect.usecases.users.create import CreateKeycloakUserUseCase
from connect.usecases.users.user_dto import KeycloakUserDTO
Expand All @@ -25,7 +24,6 @@ class CommerceSerializer(serializers.Serializer):
organization_name = serializers.CharField(required=True)
project_name = serializers.CharField(required=True)
vtex_account = serializers.CharField(required=True)
timezone = TimezoneField(required=False, initial="America/Sao_Paulo")

def publish_create_org_message(self, instance: Organization, user: User):
authorizations = []
Expand Down Expand Up @@ -74,7 +72,7 @@ def publish_create_project_message(self, instance: Project, user: User):
if instance.project_template_type
else None
),
"timezone": str(instance.timezone),
"timezone": "America/Sao_Paulo",
"organization_id": instance.organization.inteligence_organization,
"extra_fields": {},
"authorizations": authorizations,
Expand Down Expand Up @@ -124,7 +122,7 @@ def create(self, validated_data):
project = Project.objects.create(
name=validated_data.get("project_name"),
vtex_account=validated_data.get("vtex_account"),
timezone=validated_data.get("timezone"),
timezone="America/Sao_Paulo",
organization=organization,
created_by=user_info.get("user"),
is_template=False,
Expand Down

0 comments on commit d27ad7e

Please sign in to comment.