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
40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
from typing import TYPE_CHECKING
|
|
|
|
from api.v1.common.base_models import TenantScopedMixin, TimestampMixin
|
|
from core.database import Base
|
|
from sqlalchemy import (
|
|
ForeignKeyConstraint,
|
|
Integer,
|
|
PrimaryKeyConstraint,
|
|
String,
|
|
)
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
if TYPE_CHECKING:
|
|
from api.v1.modules.a76.pedmientos.models.pedimentos import Pedimentos
|
|
|
|
|
|
class PedimentoContainers(Base, TenantScopedMixin, TimestampMixin):
|
|
__tablename__ = "pedimento_containers"
|
|
__table_args__ = (
|
|
PrimaryKeyConstraint("id", name="pedimento_containers_pkey"),
|
|
ForeignKeyConstraint(
|
|
["pedimento_id"],
|
|
["a76.pedimentos.id"],
|
|
ondelete="CASCADE",
|
|
name="fk_pedimento_containers",
|
|
),
|
|
{"schema": "a76"},
|
|
)
|
|
|
|
id: Mapped[int] = mapped_column(Integer)
|
|
pedimento_id: Mapped[int] = mapped_column(Integer, nullable=False)
|
|
|
|
number: Mapped[str | None] = mapped_column(String(100), nullable=True)
|
|
identification: Mapped[str | None] = mapped_column(String(100), nullable=True)
|
|
type: Mapped[str | None] = mapped_column(String(50), nullable=True)
|
|
|
|
pedimento: Mapped["Pedimentos"] = relationship(
|
|
"Pedimentos", back_populates="pedimento_containers"
|
|
)
|