Files
plantillas-proyectos/backend/api/v1/modules/a76/pedmientos/models/pedimento_indexes.py
Galindo97 97a318fdba feat: update invoice and item tabs to use 'Datos Soriana' instead of 'Datos Sonana'
refactor: enhance package transportation tab to prevent infinite loops and load data only once

fix: include credentials in fetch request for company data

feat: implement loading of additional pedimento data in edit page, including contributions, packages, transport carriers, guides, seals, and containers

add: create DTOs and models for pedimento contributions, packages, transport carriers, guides, seals, and containers
2026-01-02 18:04:28 -06:00

49 lines
1.5 KiB
Python

from decimal import Decimal
from typing import TYPE_CHECKING, Optional
from api.v1.common.base_models import TenantScopedMixin, TimestampMixin
from core.database import Base
from sqlalchemy import (
ForeignKeyConstraint,
Integer,
Numeric,
PrimaryKeyConstraint,
SmallInteger,
UniqueConstraint,
)
from sqlalchemy.orm import Mapped, mapped_column, relationship
if TYPE_CHECKING:
from api.v1.modules.a76.pedmientos.models.pedimentos import Pedimentos
class PedimentoIndexes(Base, TenantScopedMixin, TimestampMixin):
__tablename__ = "pedimento_indexes"
__table_args__ = (
PrimaryKeyConstraint("id", name="pedimento_indexes_pkey"),
ForeignKeyConstraint(
["pedimento_id"],
["a76.pedimentos.id"],
ondelete="CASCADE",
name="fk_pedimento_indexes",
),
UniqueConstraint(
"tenant_id",
"company_id",
"pedimento_id",
name="pedimento_indexes_pedimento_id_key",
),
{"schema": "a76"},
)
id: Mapped[int] = mapped_column(Integer)
pedimento_id: Mapped[int] = mapped_column(Integer, nullable=False)
update_factor_type: Mapped[Optional[int]] = mapped_column(SmallInteger)
update_factor: Mapped[Optional[Decimal]] = mapped_column(Numeric(7, 4))
manual_update_factor: Mapped[Optional[int]] = mapped_column(SmallInteger)
pedimento: Mapped["Pedimentos"] = relationship(
"Pedimentos", back_populates="pedimento_indexes"
)