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

44 lines
1.9 KiB
Python

from api.v1.common.base_models import TenantScopedMixin
from core.database import Base
from sqlalchemy import DECIMAL, Column, ForeignKeyConstraint, Integer, String
class Vehicle(Base, TenantScopedMixin):
__tablename__ = "vehicle"
__table_args__ = (
ForeignKeyConstraint(
["tenant_id"], ["a76.tenants.id"], name="fk_vehicle_tenants"
),
ForeignKeyConstraint(
["company_id"], ["a76.company.id"], name="fk_vehicle_company"
),
{"schema": "a76"},
)
vehicle_key = Column(String(14), primary_key=True, nullable=False)
ace_vehicle_key = Column(String(10), nullable=True)
transporter_key = Column(String(23), nullable=True)
transport_identifier = Column(String(30), nullable=True)
transport_type = Column(String(2), nullable=True)
entity_code = Column(String(1), nullable=True)
transponder_number = Column(String(16), nullable=True)
dot_number = Column(String(8), nullable=True)
plate_number = Column(String(17), nullable=True)
city = Column(String(30), nullable=True)
state = Column(String(30), nullable=True)
country = Column(String(3), nullable=True)
seal = Column(String(49), nullable=True)
insurance_company_name = Column(String(30), nullable=True)
insurance_number = Column(String(20), nullable=True)
insurance_amount = Column(DECIMAL(13, 2), nullable=True)
insurance_date = Column(Integer, nullable=True)
box_number = Column(String(300), nullable=True)
brand = Column(String(20), nullable=True)
year = Column(String(4), nullable=True)
series = Column(String(30), nullable=True)
description = Column(String(100), nullable=True)
engine_number = Column(String(50), nullable=True)
sct_permission = Column(String(40), nullable=True)
color = Column(String(20), nullable=True)
container_key = Column(String(3), nullable=True)