Files
plantillas-proyectos/backend/api/v1/modules/a76/pedmientos/models/pedimento_incrementables.py
acazares 07dfe1edb1 Add service layers and models for Pedimento CRUD operations
- 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.
2025-11-06 17:16:29 -06:00

31 lines
1.6 KiB
Python

from sqlalchemy import DateTime, ForeignKeyConstraint, Integer, Numeric, PrimaryKeyConstraint, SmallInteger, String, UniqueConstraint, text
from sqlalchemy.orm import Mapped, mapped_column, relationship
from sqlalchemy.orm.base import Mapped
from core.database import Base
class PedimentoIncrementables(Base):
__tablename__ = 'pedimento_incrementables'
__table_args__ = (
ForeignKeyConstraint(['tenant_id'], ['a76.tenants.id']),
ForeignKeyConstraint(['pedimento_id'], ['a76.pedimentos.id'], ondelete='CASCADE', name='fk_pedimento_incrementables'),
PrimaryKeyConstraint('id', name='pedimento_incrementables_pkey'),
UniqueConstraint('pedimento_id', name='pedimento_incrementables_pedimento_id_key'),
{'schema': 'a76'}
)
id = mapped_column(Integer)
pedimento_id = mapped_column(Integer, nullable=False)
tenant_id = mapped_column(Integer, nullable=False, index=True)
insured_value = mapped_column(Numeric(13, 2))
freight = mapped_column(Numeric(13, 2))
insurance = mapped_column(Numeric(13, 2))
packaging = mapped_column(Numeric(13, 2))
others = mapped_column(Numeric(13, 3))
deductibles = mapped_column(Numeric(13, 3))
currency = mapped_column(String(3))
currency_factor = mapped_column(Numeric(15, 8))
not_affect_usd_value = mapped_column(SmallInteger)
not_affect_customs_value = mapped_column(SmallInteger)
created_at = mapped_column(DateTime, server_default=text('CURRENT_TIMESTAMP'))
pedimento: Mapped['Pedimentos'] = relationship('Pedimentos', back_populates='pedimento_incrementables')