- Updated GBultoService to use models.Package instead of models.GBulto. - Refactored Part model to use SQLAlchemy 2.0 style with Mapped and mapped_column. - Added timestamps (created_at, updated_at, deleted_at) to various pedimento models. - Improved relationships and foreign key constraints in pedimento models. - Updated PermissionRuleOct and Seal models to use Mapped and mapped_column. - Changed DTO configuration from orm_mode to from_attributes for better compatibility. - Removed obsolete models (models.py and models_ped.py) from the repository.
22 lines
1.0 KiB
Python
22 lines
1.0 KiB
Python
from typing import Optional
|
|
from decimal import Decimal
|
|
from sqlalchemy import Integer, String, DECIMAL, PrimaryKeyConstraint, DateTime, ForeignKeyConstraint, UniqueConstraint, ForeignKey
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
from core.database import Base
|
|
|
|
|
|
class ExchangeRate(Base):
|
|
__tablename__ = "exchange_rate"
|
|
__table_args__ = (
|
|
PrimaryKeyConstraint('id', name='exchange_rate_pkey'),
|
|
ForeignKeyConstraint(['tenant_id'], ['a76.tenants.id'], name='fk_exchange_rate_tenant'),
|
|
UniqueConstraint('date', 'tenant_id', name='uq_exchange_rate_date_tenant'),
|
|
{"schema": "a76"}
|
|
)
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
date: Mapped[int] = mapped_column(DateTime)
|
|
value: Mapped[Optional[Decimal]] = mapped_column(DECIMAL(13, 6))
|
|
local_currency: Mapped[Optional[str]] = mapped_column(String(7))
|
|
foreign_currency: Mapped[Optional[str]] = mapped_column(String(7))
|
|
tenant_id: Mapped[int] = mapped_column(Integer, nullable=False, index=True) |