From 2a468cc859b8da2647ce0519d33082baccf1f714 Mon Sep 17 00:00:00 2001 From: acazares Date: Wed, 21 Jan 2026 12:27:08 -0600 Subject: [PATCH] fix(models): update Company model to extend existing schema and clean up LineItem model --- .../api/v1/modules/a76/general_catalogs/company/models.py | 2 +- .../api/v1/modules/a76/general_catalogs/company/routes.py | 2 +- backend/api/v1/modules/a76/items/line_items/models.py | 5 ----- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/backend/api/v1/modules/a76/general_catalogs/company/models.py b/backend/api/v1/modules/a76/general_catalogs/company/models.py index c6d37213..a1bd5d99 100644 --- a/backend/api/v1/modules/a76/general_catalogs/company/models.py +++ b/backend/api/v1/modules/a76/general_catalogs/company/models.py @@ -21,7 +21,7 @@ class Company(Base, TimestampMixin): """Información principal de la empresa""" __tablename__ = "company" - __table_args__ = {"schema": "a76"} + __table_args__ = {"schema": "a76", "extend_existing": True} # Primary key id: Mapped[int] = mapped_column(Integer, primary_key=True) diff --git a/backend/api/v1/modules/a76/general_catalogs/company/routes.py b/backend/api/v1/modules/a76/general_catalogs/company/routes.py index cc507462..cc59a1bc 100644 --- a/backend/api/v1/modules/a76/general_catalogs/company/routes.py +++ b/backend/api/v1/modules/a76/general_catalogs/company/routes.py @@ -11,7 +11,7 @@ from pathlib import Path from datetime import datetime from fastapi import APIRouter, Depends, HTTPException, status, File, UploadFile -from fastapi.responses import FileResponse, UploadFile, File +from fastapi.responses import FileResponse from sqlalchemy.orm import Session from core.database import get_core_db diff --git a/backend/api/v1/modules/a76/items/line_items/models.py b/backend/api/v1/modules/a76/items/line_items/models.py index c3641ee6..a617fb68 100644 --- a/backend/api/v1/modules/a76/items/line_items/models.py +++ b/backend/api/v1/modules/a76/items/line_items/models.py @@ -26,11 +26,6 @@ class LineItem(Base, TenantScopedMixin, TimestampMixin): __tablename__ = "item_lines" __table_args__ = ( - ForeignKeyConstraint( - ["class_code", "tenant_id", "company_id"], - ["a76.classes.class_code", "a76.classes.tenant_id", "a76.classes.company_id"], - name="fk_item_lines_class" - ), {"schema": "a76"}, )