- 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.
21 lines
1.0 KiB
Python
21 lines
1.0 KiB
Python
from typing import Optional
|
|
from sqlalchemy import Integer, String, ForeignKey, PrimaryKeyConstraint, ForeignKeyConstraint, UniqueConstraint
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
from core.database import Base
|
|
|
|
|
|
class PermissionRuleOct(Base):
|
|
__tablename__ = "permission_rule_oct"
|
|
__table_args__ = (
|
|
PrimaryKeyConstraint('id', name='permission_rule_oct_pkey'),
|
|
UniqueConstraint('permission', 'tenant_id', name='permission_rule_oct_permission_tenant_ukey'),
|
|
ForeignKeyConstraint(['tenant_id'], ['a76.tenants.id'], name='fk_permission_rule_oct_tenant'),
|
|
{"schema": "a76"}
|
|
)
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
permission: Mapped[str] = mapped_column(String(20))
|
|
start_date: Mapped[Optional[int]] = mapped_column()
|
|
end_date: Mapped[Optional[int]] = mapped_column()
|
|
sector: Mapped[Optional[str]] = mapped_column(String(8))
|
|
system: Mapped[Optional[str]] = mapped_column(String(5))
|
|
tenant_id: Mapped[int] = mapped_column(Integer, nullable=False, index=True) |