refactor: remove hybrid handling of has_express_line in company service
This commit is contained in:
@@ -147,11 +147,6 @@ class CompanyService:
|
||||
# Explicitly ensure logo is present (defensive programming)
|
||||
if hasattr(company, 'logo'):
|
||||
result['logo'] = company.logo
|
||||
|
||||
# Convert has_express_line from String "S"/"N" to Boolean
|
||||
if hasattr(company, 'has_express_line'):
|
||||
val = getattr(company, 'has_express_line', "N")
|
||||
result['has_express_line'] = (val == "S")
|
||||
|
||||
# 2. Certification fields
|
||||
if company.certification:
|
||||
@@ -185,11 +180,6 @@ class CompanyService:
|
||||
# 1. Preparar datos
|
||||
obj_data = data.model_dump(exclude_unset=True)
|
||||
|
||||
# Handle boolean flags for Company (Hybrid Approach)
|
||||
# has_express_line is String(2), is_service_company is Boolean
|
||||
if "has_express_line" in obj_data and isinstance(obj_data["has_express_line"], bool):
|
||||
obj_data["has_express_line"] = "S" if obj_data["has_express_line"] else "N"
|
||||
|
||||
# 2. Extract fields for each model
|
||||
company_data = self._extract_company_fields(obj_data)
|
||||
cert_data = self._extract_certification_fields(obj_data)
|
||||
@@ -253,10 +243,6 @@ class CompanyService:
|
||||
# 1. Update Company fields
|
||||
company_fields = self._extract_company_fields(update_data)
|
||||
|
||||
# Hybrid Approach: has_express_line is String, is_service_company is Boolean
|
||||
if "has_express_line" in company_fields and isinstance(company_fields["has_express_line"], bool):
|
||||
company_fields["has_express_line"] = "S" if company_fields["has_express_line"] else "N"
|
||||
|
||||
for field, value in company_fields.items():
|
||||
setattr(company, field, value)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user