- Implemented service classes for PedimentoConfigParameters, PedimentoConfigSurcharges, PedimentoConfigUpdateRectification, PedimentoConfigUpdates, PedimentoCustomsOffices, PedimentoDates, PedimentoDecrementables, PedimentoIncrementables, PedimentoIndexes, PedimentoPayments, PedimentoRectificationDestination, PedimentoRectificationOrigin, PedimentoTransportMeans, and PedimentoValidation. - Each service class includes methods for CRUD operations: create, read, update, and delete. - Added a main router for the API v1, integrating various modules including authentication, tenants, licenses, and pedimentos. - Created models for PedimentoValidation with appropriate constraints and relationships.
55 lines
2.3 KiB
Python
55 lines
2.3 KiB
Python
from pydantic import BaseModel, Field, ConfigDict
|
|
from typing import Optional
|
|
from decimal import Decimal
|
|
from datetime import datetime
|
|
|
|
|
|
class PedimentosBase(BaseModel):
|
|
"""Base schema for Pedimentos"""
|
|
year: Optional[str] = Field(None, max_length=2, description="Year")
|
|
customs_office: Optional[str] = Field(None, max_length=2, description="Customs office")
|
|
license: Optional[str] = Field(None, max_length=4, description="License")
|
|
pedimento_number: Optional[str] = Field(None, max_length=7, description="Pedimento number")
|
|
client_id: Optional[int] = Field(None, description="Client ID")
|
|
operation_type: Optional[int] = Field(None, description="Operation type")
|
|
pedimento_type: Optional[int] = Field(None, description="Pedimento type")
|
|
pedimento_key: Optional[str] = Field(None, max_length=2, description="Pedimento key")
|
|
regime: Optional[str] = Field(None, max_length=3, description="Regime")
|
|
status: Optional[str] = Field(None, max_length=30, description="Status")
|
|
usd_value: Optional[Decimal] = Field(None, description="USD value")
|
|
paid_price: Optional[Decimal] = Field(None, description="Paid price")
|
|
gross_weight: Optional[Decimal] = Field(None, description="Gross weight")
|
|
exchange_rate: Optional[Decimal] = Field(None, description="Exchange rate")
|
|
|
|
|
|
class PedimentosCreate(PedimentosBase):
|
|
"""Schema for creating a new Pedimento"""
|
|
pass
|
|
|
|
|
|
class PedimentosUpdate(BaseModel):
|
|
"""Schema for updating a Pedimento"""
|
|
year: Optional[str] = Field(None, max_length=2)
|
|
customs_office: Optional[str] = Field(None, max_length=2)
|
|
license: Optional[str] = Field(None, max_length=4)
|
|
pedimento_number: Optional[str] = Field(None, max_length=7)
|
|
client_id: Optional[int] = None
|
|
operation_type: Optional[int] = None
|
|
pedimento_type: Optional[int] = None
|
|
pedimento_key: Optional[str] = Field(None, max_length=2)
|
|
regime: Optional[str] = Field(None, max_length=3)
|
|
status: Optional[str] = Field(None, max_length=30)
|
|
usd_value: Optional[Decimal] = None
|
|
paid_price: Optional[Decimal] = None
|
|
gross_weight: Optional[Decimal] = None
|
|
exchange_rate: Optional[Decimal] = None
|
|
|
|
|
|
class PedimentosResponse(PedimentosBase):
|
|
"""Schema for Pedimento response"""
|
|
id: int
|
|
tenant_id: int
|
|
created_at: datetime
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|