Files
plantillas-proyectos/backend/api/v1/modules/a76/drivers/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

43 lines
1.8 KiB
Python

from api.v1.common.base_models import TenantScopedMixin
from core.database import Base
from sqlalchemy import Column, ForeignKey, ForeignKeyConstraint, Integer, String
class Driver(Base, TenantScopedMixin):
__tablename__ = "driver"
__table_args__ = (
ForeignKeyConstraint(["company_id"], ["a76.company.id"]),
ForeignKeyConstraint(["tenant_id"], ["a76.tenants.id"]),
{"schema": "a76"},
)
transporter_key = Column(
String(5),
ForeignKey("a76.transporter.transporter_key", ondelete="CASCADE"),
primary_key=True,
nullable=False,
)
line = Column(Integer, primary_key=True, nullable=False)
driver_name = Column(String(80), nullable=True)
license_number = Column(String(29), nullable=True)
express_line_id = Column(String(17), nullable=True)
ace_id = Column(String(20), nullable=True)
birth_date = Column(Integer, nullable=True)
gender = Column(String(1), nullable=True)
birth_country = Column(String(3), nullable=True)
hazardous_material_auth = Column(String(2), nullable=True)
hazardous_material_state = Column(String(30), nullable=True)
first_name = Column(String(20), nullable=True)
last_name = Column(String(20), nullable=True)
id_key1 = Column(String(40), nullable=True)
id_number1 = Column(String(20), nullable=True)
id_state1 = Column(String(30), nullable=True)
id_country1 = Column(String(3), nullable=True)
id_key2 = Column(String(40), nullable=True)
id_number2 = Column(String(20), nullable=True)
id_state2 = Column(String(30), nullable=True)
id_country2 = Column(String(3), nullable=True)
badge_number = Column(String(20), nullable=True)
class_type = Column(String(1), nullable=True)
unique_badge_number = Column(String(100), nullable=True)