Refactor DTO classes to use model_config with ConfigDict for attribute handling
- Updated multiple DTO classes across various modules to replace the `Config` class with `model_config = ConfigDict(from_attributes=True)`. - This change enhances consistency in attribute handling and aligns with the latest Pydantic practices. - Adjusted error handling in core modules to change status codes from `HTTP_422_UNPROCESSABLE_ENTITY` to `HTTP_422_UNPROCESSABLE_CONTENT` for improved clarity in validation responses.
This commit is contained in:
@@ -60,8 +60,7 @@ class FaLineItemCreateDTO(BaseModel):
|
||||
own_equipment: Optional[bool] = Field(None, description="Equipo propio")
|
||||
omit_annex31: Optional[bool] = Field(None, description="Omitir en Anexo 31")
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
|
||||
class FaLineItemUpdateDTO(BaseModel):
|
||||
@@ -112,8 +111,7 @@ class FaLineItemUpdateDTO(BaseModel):
|
||||
own_equipment: Optional[bool] = Field(None, description="Equipo propio")
|
||||
omit_annex31: Optional[bool] = Field(None, description="Omitir en Anexo 31")
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
|
||||
class FaLineItemResponseDTO(BaseModel):
|
||||
@@ -164,5 +162,4 @@ class FaLineItemResponseDTO(BaseModel):
|
||||
created_at: datetime = Field(..., description="Fecha de creación")
|
||||
updated_at: datetime = Field(..., description="Fecha de actualización")
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
Reference in New Issue
Block a user