- Added new schemas for FA line items in the backend, including creation, update, and response DTOs. - Updated existing line item schemas to include FA data. - Modified database models to reflect new table names for line quantities and references. - Enhanced ItemService to handle FA data during item creation and updates. - Introduced new routes and service layer for FA line items, including CRUD operations. - Updated frontend components to support FA line item data, including new fields and UI adjustments. - Implemented data flattening for improved item display in the dashboard.
43 lines
1.9 KiB
Python
43 lines
1.9 KiB
Python
from typing import Optional, TYPE_CHECKING
|
|
from sqlalchemy import Boolean, String, Text, ForeignKey
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
from core.database import Base
|
|
|
|
if TYPE_CHECKING:
|
|
from ..line_items.models import LineItem
|
|
|
|
class LineDescription(Base):
|
|
"""
|
|
Description details for line items
|
|
Consolidates all line-level data from Q and S tables
|
|
"""
|
|
__tablename__ = "item_line_descriptions"
|
|
__table_args__ = {
|
|
"schema": "a76",
|
|
}
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
|
|
item_line_id: Mapped[int] = mapped_column(ForeignKey("a76.item_lines.id"))
|
|
|
|
# Descriptions
|
|
description_spanish: Mapped[Optional[str]] = mapped_column(String(4999)) # DESCRIPCIONE
|
|
description_english: Mapped[Optional[str]] = mapped_column(String(4999)) # DESCRIPCIONI
|
|
extra_description: Mapped[Optional[str]] = mapped_column(Text) # DESCRIPCIONEEXTRA
|
|
part_description: Mapped[Optional[str]] = mapped_column(String(500)) # DESCRIPCIONPARTE
|
|
class_description: Mapped[Optional[str]] = mapped_column(String(500)) # DESCRIPCIONCLASE
|
|
|
|
# Product attributes
|
|
brand: Mapped[Optional[str]] = mapped_column(String(50)) # MARCA
|
|
model: Mapped[Optional[str]] = mapped_column(String(50)) # MODELO
|
|
has_serial: Mapped[Optional[bool]] = mapped_column(Boolean) # LLEVASERIE
|
|
|
|
# Additional information
|
|
additional_info_spanish: Mapped[Optional[str]] = mapped_column(String(1000)) # INFOADICIONESP
|
|
additional_info_english: Mapped[Optional[str]] = mapped_column(String(1000)) # INFOADICIONING
|
|
|
|
# Lot and entry tracking
|
|
lot: Mapped[Optional[str]] = mapped_column(String(254)) # LOTE
|
|
entry_number: Mapped[Optional[str]] = mapped_column(String(50)) # NUMENTRADA/NUMERODEENTRADA
|
|
|
|
# Relationship (one-to-one)
|
|
line: Mapped["LineItem"] = relationship(back_populates="description") |