Files
plantillas-proyectos/backend/api/v1/modules/a76/aduanal/models.py
acazares b68c4316ff Refactor backend and frontend code for improved structure and functionality
- Rearranged imports in multiple files for consistency and clarity.
- Updated logging middleware to exclude specific paths from logging.
- Enhanced security module by cleaning up token handling and improving tenant validation.
- Added tenant and company scoped mixins for better database model management.
- Implemented generic CRUD routes for tenant-scoped resources.
- Improved error handling and response management in API routes.
- Cleaned up login and logout processes to ensure proper session management.
- Introduced mechanisms to clear local storage and cookies on tenant change.
- Enhanced company store to detect tenant changes and clear data accordingly.
- Added new DTO mixins for currency and value affect flags.
2025-11-11 17:20:47 -06:00

96 lines
3.8 KiB
Python

from api.v1.common.base_models import TenantScopedMixin
from core.database import Base
from sqlalchemy import Column, ForeignKey, ForeignKeyConstraint, Integer, String
from sqlalchemy.orm import relationship
class CustomsBroker(Base, TenantScopedMixin):
__tablename__ = "customs_brokers"
__table_args__ = (
ForeignKeyConstraint(
["tenant_id"], ["a76.tenants.id"], name="fk_customs_brokers_tenants"
),
ForeignKeyConstraint(
["company_id"], ["a76.company.id"], name="fk_customs_brokers_company"
),
{"schema": "a76"},
)
type = Column(String(9), nullable=True)
broker_key = Column(String(5), primary_key=True, nullable=False)
name = Column(String(80), nullable=True)
address = Column(String(1500), nullable=True)
postal_code = Column(String(15), nullable=True)
city = Column(String(30), nullable=True)
state = Column(String(30), nullable=True)
phone = Column(String(30), nullable=True)
fax = Column(String(30), nullable=True)
email = Column(String(100), nullable=True)
country = Column(String(3), nullable=True)
tax_id = Column(String(30), nullable=True)
personal_id = Column(String(20), nullable=True)
position = Column(String(30), nullable=True)
license = Column(String(4), nullable=True)
company = Column(String(200), nullable=True)
contact = Column(String(80), nullable=True)
vu = relationship(
"CustomsBrokerVU", back_populates="customs_broker", cascade="all, delete"
)
personnel = relationship(
"CustomsBrokerPersonnel", back_populates="customs_broker", cascade="all, delete"
)
class CustomsBrokerVU(Base):
__tablename__ = "customs_brokers_vu"
broker_key = Column(
String(5),
ForeignKey("a76.customs_brokers.broker_key", ondelete="CASCADE"),
primary_key=True,
)
certificate_path = Column(String(1499), nullable=True)
key_path = Column(String(1499), nullable=True)
access_key = Column(String(50), nullable=True)
fiel_format = Column(String(19), nullable=True)
signature_read_path = Column(String(1499), nullable=True)
archive_path = Column(String(1499), nullable=True)
fiel_access_key = Column(String(50), nullable=True)
web_service_user = Column(String(100), nullable=True)
web_service_access_key = Column(String(100), nullable=True)
vu_email = Column(String(800), nullable=True)
vu_figure_type = Column(String(29), nullable=True)
xml_files_path = Column(String(1499), nullable=True)
query_tax_id = Column(String(30), nullable=True)
doda_certificate_path = Column(String(1499), nullable=True)
doda_key_path = Column(String(1499), nullable=True)
doda_web_service_user = Column(String(100), nullable=True)
doda_web_service_access_key = Column(String(100), nullable=True)
doda_fiel_access_key = Column(String(50), nullable=True)
doda_xml_files_path = Column(String(1499), nullable=True)
customs_broker = relationship("CustomsBroker", back_populates="vu")
class CustomsBrokerPersonnel(Base):
__tablename__ = "customs_brokers_personnel"
broker_key = Column(
String(5),
ForeignKey("a76.customs_brokers.broker_key", ondelete="CASCADE"),
primary_key=True,
)
line = Column(Integer, primary_key=True, nullable=False)
name = Column(String(80), nullable=True)
tax_id = Column(String(30), nullable=True)
personal_id = Column(String(20), nullable=True)
position = Column(String(30), nullable=True)
license = Column(String(4), nullable=True)
first_name = Column(String(80), nullable=True)
last_name = Column(String(80), nullable=True)
middle_name = Column(String(80), nullable=True)
email = Column(String(100), nullable=True)
customs_broker = relationship("CustomsBroker", back_populates="personnel")