- 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.
53 lines
3.8 KiB
Python
53 lines
3.8 KiB
Python
from sqlalchemy import DateTime, ForeignKeyConstraint, Index, Integer, Numeric, PrimaryKeyConstraint, String, text
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
from sqlalchemy.orm.base import Mapped
|
|
from core.database import Base
|
|
|
|
|
|
class Pedimentos(Base):
|
|
__tablename__ = 'pedimentos'
|
|
__table_args__ = (
|
|
ForeignKeyConstraint(['tenant_id'], ['a76.tenants.id']),
|
|
PrimaryKeyConstraint('id', name='pedimentos_pkey'),
|
|
Index('idx_pedimentos_client_id', 'client_id'),
|
|
Index('idx_pedimentos_created_at', 'created_at'),
|
|
Index('idx_pedimentos_status', 'status'),
|
|
{'schema': 'a76'}
|
|
)
|
|
|
|
id = mapped_column(Integer)
|
|
tenant_id = mapped_column(Integer, nullable=False, index=True)
|
|
year = mapped_column(String(2))
|
|
customs_office = mapped_column(String(2))
|
|
license = mapped_column(String(4))
|
|
pedimento_number = mapped_column(String(7))
|
|
client_id = mapped_column(Integer)
|
|
operation_type = mapped_column(Integer)
|
|
pedimento_type = mapped_column(Integer)
|
|
pedimento_key = mapped_column(String(2))
|
|
regime = mapped_column(String(3))
|
|
status = mapped_column(String(30))
|
|
usd_value = mapped_column(Numeric(17, 6))
|
|
paid_price = mapped_column(Numeric(17, 6))
|
|
gross_weight = mapped_column(Numeric(19, 3))
|
|
exchange_rate = mapped_column(Numeric(9, 5))
|
|
created_at = mapped_column(DateTime, server_default=text('CURRENT_TIMESTAMP'))
|
|
|
|
pedimento_config_additional: Mapped['PedimentoConfigAdditional'] = relationship('PedimentoConfigAdditional', uselist=False, back_populates='pedimento')
|
|
pedimento_config_calculations: Mapped['PedimentoConfigCalculations'] = relationship('PedimentoConfigCalculations', uselist=False, back_populates='pedimento')
|
|
pedimento_config_parameters: Mapped['PedimentoConfigParameters'] = relationship('PedimentoConfigParameters', uselist=False, back_populates='pedimento')
|
|
pedimento_config_surcharges: Mapped['PedimentoConfigSurcharges'] = relationship('PedimentoConfigSurcharges', uselist=False, back_populates='pedimento')
|
|
pedimento_config_update_rectification: Mapped['PedimentoConfigUpdateRectification'] = relationship('PedimentoConfigUpdateRectification', uselist=False, back_populates='pedimento')
|
|
pedimento_config_updates: Mapped['PedimentoConfigUpdates'] = relationship('PedimentoConfigUpdates', uselist=False, back_populates='pedimento')
|
|
pedimento_customs_offices: Mapped['PedimentoCustomsOffices'] = relationship('PedimentoCustomsOffices', uselist=False, back_populates='pedimento')
|
|
pedimento_dates: Mapped['PedimentoDates'] = relationship('PedimentoDates', uselist=False, back_populates='pedimento')
|
|
pedimento_decrementables: Mapped['PedimentoDecrementables'] = relationship('PedimentoDecrementables', uselist=False, back_populates='pedimento')
|
|
pedimento_incrementables: Mapped['PedimentoIncrementables'] = relationship('PedimentoIncrementables', uselist=False, back_populates='pedimento')
|
|
pedimento_indexes: Mapped['PedimentoIndexes'] = relationship('PedimentoIndexes', uselist=False, back_populates='pedimento')
|
|
pedimento_payments: Mapped['PedimentoPayments'] = relationship('PedimentoPayments', uselist=False, back_populates='pedimento')
|
|
pedimento_rectification_destination: Mapped['PedimentoRectificationDestination'] = relationship('PedimentoRectificationDestination', uselist=False, back_populates='pedimento')
|
|
pedimento_rectification_origin: Mapped['PedimentoRectificationOrigin'] = relationship('PedimentoRectificationOrigin', uselist=False, back_populates='pedimento')
|
|
pedimento_transport_means: Mapped['PedimentoTransportMeans'] = relationship('PedimentoTransportMeans', uselist=False, back_populates='pedimento')
|
|
pedimento_validation: Mapped['PedimentoValidation'] = relationship('PedimentoValidation', uselist=False, back_populates='pedimento')
|
|
|