open box bug

This commit is contained in:
2025-02-10 20:35:26 -05:00
parent c896a6ea0f
commit c7686fb239
4 changed files with 12 additions and 14 deletions

View File

@@ -243,7 +243,7 @@ class File(Base):
filepath = Column(String) # backup location
filesize_kb = Column(Float)
status = Column(String)
box_id = Column(String, ForeignKey("boxes.product_id"), nullable=True)
box_id = Column(String, nullable=True)
date_created = Column(DateTime, default=datetime.now)
date_modified = Column(DateTime, default=datetime.now, onupdate=datetime.now)

View File

@@ -57,7 +57,7 @@ class CreateOpenBoxRequest(BaseModel):
product_id: str = Field(..., title="Product ID")
file_ids: list[str] = Field(None, title="File IDs")
num_cards_actual: Optional[int] = Field(None, title="Number of cards actual")
date_opened: Optional [str] = Field(None, title="Date Opened")
date_opened: Optional[str] = Field(None, title="Date Opened")
# RESPONSE
class CreateOpenBoxResponse(BaseModel):

View File

@@ -150,6 +150,7 @@ class BoxService:
date_opened=datetime.strptime(box_data.date_opened, "%Y-%m-%d") if box_data.date_opened else datetime.now()
)
self.db.add(open_box)
self.db.flush()
staged_product_data = self.get_staged_product_data(box_data.file_ids)
product_data = self.aggregate_staged_product_data(staged_product_data)