Files
plantillas-proyectos/backend/api/v1/modules/a76/pedmientos/dtos/pedimento_validation.py
acazares 404333f35e Refactor Pedimento data structure and update forms
- Expanded the PedimentoDates, PedimentoPayments, PedimentoTransportMeans, and PedimentoValidation interfaces to include additional fields.
- Updated the dates, payments, transport, and validation tab forms to initialize form data directly from the Pedimento object, removing unnecessary API calls for data loading.
- Enhanced the payload construction in the edit page to conditionally include sub-resources only if they contain values, improving data handling during creation and update operations.
- Adjusted the form bindings to reflect the new structure and ensure proper data flow between the components.
2025-11-18 18:20:04 -06:00

63 lines
2.7 KiB
Python

from datetime import datetime
from typing import Optional
from pydantic import BaseModel, ConfigDict, Field
class PedimentoValidationBase(BaseModel):
"""Base schema for Pedimento Validation"""
pedimento_id: int = Field(..., description="Pedimento ID")
tenant_id: int = Field(..., description="Tenant ID")
validator: Optional[str] = Field(None, max_length=3, description="Validator")
validation_ack: Optional[str] = Field(
None, max_length=8, description="Validation acknowledgment"
)
pre_ack: Optional[str] = Field(None, max_length=8, description="Pre-acknowledgment")
line_signature: Optional[str] = Field(
None, max_length=50, description="Line signature"
)
electronic_signature: Optional[str] = Field(
None, max_length=999, description="Electronic signature"
)
certificate_number: Optional[str] = Field(
None, max_length=99, description="Certificate number"
)
validator_id: Optional[int] = Field(None, description="Validator ID")
responsible_id: Optional[int] = Field(None, description="Responsible ID")
class PedimentoValidationCreate(BaseModel):
"""Schema for creating a new Pedimento Validation - pedimento_id and tenant_id are set by backend"""
validator: Optional[str] = Field(None, max_length=3, description="Validator")
validation_ack: Optional[str] = Field(None, max_length=8, description="Validation acknowledgment")
pre_ack: Optional[str] = Field(None, max_length=8, description="Previous acknowledgment")
line_signature: Optional[str] = Field(None, max_length=50, description="Line signature")
electronic_signature: Optional[str] = Field(None, max_length=999, description="Electronic signature")
certificate_number: Optional[str] = Field(None, max_length=99, description="Certificate number")
validator_id: Optional[int] = Field(None, description="Validator ID")
responsible_id: Optional[int] = Field(None, description="Responsible ID")
class PedimentoValidationUpdate(BaseModel):
"""Schema for updating a Pedimento Validation"""
validator: Optional[str] = Field(None, max_length=3)
validation_ack: Optional[str] = Field(None, max_length=8)
pre_ack: Optional[str] = Field(None, max_length=8)
line_signature: Optional[str] = Field(None, max_length=50)
electronic_signature: Optional[str] = Field(None, max_length=999)
certificate_number: Optional[str] = Field(None, max_length=99)
validator_id: Optional[int] = None
responsible_id: Optional[int] = None
class PedimentoValidationResponse(PedimentoValidationBase):
"""Schema for Pedimento Validation response"""
id: int
created_at: datetime
model_config = ConfigDict(from_attributes=True)