feat: Update API endpoints to ensure trailing slashes and adjust data types in models

This commit is contained in:
AlexeerCT
2026-01-02 13:35:01 -06:00
parent e554c4fca3
commit 104014d0fa
10 changed files with 46 additions and 54 deletions

View File

@@ -24,7 +24,7 @@ class PedimentoDatesBase(BaseModel):
class PedimentoDatesCreate(BaseModel):
"""Schema for creating a new Pedimento Dates - pedimento_id and tenant_id are set by backend"""
entry_date: Optional[datetime] = Field(None, description="Entry date")
entry_date: datetime = Field(..., description="Entry date")
pedimento_date: Optional[datetime] = Field(None, description="Pedimento date")
payment_date: datetime = Field(..., description="Payment date")
rectification_payment_date: Optional[datetime] = Field(None, description="Rectification payment date")

View File

@@ -1,13 +1,12 @@
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Optional
from api.v1.common.base_models import TenantScopedMixin, TimestampMixin
from core.database import Base
from sqlalchemy import (
Boolean,
ForeignKeyConstraint,
Integer,
PrimaryKeyConstraint,
SmallInteger,
String,
UniqueConstraint,
)
from sqlalchemy.orm import Mapped, mapped_column, relationship
@@ -38,12 +37,12 @@ class PedimentoConfigAdditional(Base, TenantScopedMixin, TimestampMixin):
id: Mapped[int] = mapped_column(Integer)
pedimento_id: Mapped[int] = mapped_column(Integer, nullable=False)
add_po_identifier: Mapped[int] = mapped_column(SmallInteger)
do_not_exempt_norms_complement_x: Mapped[int] = mapped_column(SmallInteger)
manual_pedimento_year: Mapped[str] = mapped_column(String(2))
enable_import_invoice_recipient: Mapped[int] = mapped_column(SmallInteger)
send_502_validation_file_for_consolidated: Mapped[int] = mapped_column(SmallInteger)
add_remove_norms: Mapped[int] = mapped_column(SmallInteger)
add_po_identifier: Mapped[bool] = mapped_column(Boolean)
do_not_exempt_norms_complement_x: Mapped[bool] = mapped_column(Boolean)
manual_pedimento_year: Mapped[Optional[int]] = mapped_column(Integer)
enable_import_invoice_recipient: Mapped[bool] = mapped_column(Boolean)
send_502_validation_file_for_consolidated: Mapped[bool] = mapped_column(Boolean)
add_remove_norms: Mapped[bool] = mapped_column(Boolean)
pedimento: Mapped["Pedimentos"] = relationship(
"Pedimentos", back_populates="pedimento_config_additional"

View File

@@ -3,6 +3,7 @@ from typing import TYPE_CHECKING
from api.v1.common.base_models import TenantScopedMixin, TimestampMixin
from core.database import Base
from sqlalchemy import (
Boolean,
ForeignKeyConstraint,
Integer,
PrimaryKeyConstraint,
@@ -37,12 +38,12 @@ class PedimentoConfigSurcharges(Base, TenantScopedMixin, TimestampMixin):
id: Mapped[int] = mapped_column(Integer)
pedimento_id: Mapped[int] = mapped_column(Integer, nullable=False)
surcharge_igi: Mapped[int] = mapped_column(SmallInteger)
surcharge_dta: Mapped[int] = mapped_column(SmallInteger)
surcharge_vat: Mapped[int] = mapped_column(SmallInteger)
surcharge_isan: Mapped[int] = mapped_column(SmallInteger)
surcharge_ieps: Mapped[int] = mapped_column(SmallInteger)
surcharge_cc: Mapped[int] = mapped_column(SmallInteger)
surcharge_igi: Mapped[bool] = mapped_column(Boolean)
surcharge_dta: Mapped[bool] = mapped_column(Boolean)
surcharge_vat: Mapped[bool] = mapped_column(Boolean)
surcharge_isan: Mapped[bool] = mapped_column(Boolean)
surcharge_ieps: Mapped[bool] = mapped_column(Boolean)
surcharge_cc: Mapped[bool] = mapped_column(Boolean)
pedimento: Mapped["Pedimentos"] = relationship(
"Pedimentos", back_populates="pedimento_config_surcharges"