Files
plantillas-proyectos/backend/api/v1/modules/a24/inv/location/models.py
acazares dc0fac9b3e feat: Implement general catalogs for ports, unit conversions, and units of measure
- Added models, DTOs, services, and routes for ports, including CRUD operations.
- Introduced unit conversions with corresponding models, DTOs, services, and routes.
- Developed units of measure with detailed models, DTOs, services, and routes for various types.
- Ensured all new features are integrated with FastAPI and SQLAlchemy for seamless database interactions.
2025-12-08 10:13:02 -06:00

37 lines
1.1 KiB
Python

"""
Modelos ORM para gestión de localización
"""
from typing import Optional
from api.v1.common.base_models import TenantScopedMixin, TimestampMixin
from core.database import Base
from sqlalchemy import Integer, PrimaryKeyConstraint, String, UniqueConstraint
from sqlalchemy.orm import Mapped, mapped_column
class Location(Base, TenantScopedMixin, TimestampMixin):
"""
Modelo para la tabla Location - Localización
"""
__tablename__ = "location" # SLocalizacion
__table_args__ = (
PrimaryKeyConstraint("id", name="location_pkey"),
UniqueConstraint("code", name="location_code_unique"),
{"schema": "a24"},
)
# Primary key
id: Mapped[int] = mapped_column(
Integer, primary_key=True, autoincrement=True)
# Location code (unique)
code: Mapped[str] = mapped_column(String(5), nullable=False, unique=True)
# Location description
description: Mapped[Optional[str]] = mapped_column(String(200))
def __repr__(self):
return f"<Location(id={self.id}, code={self.code}, description={self.description})>"