Przeglądaj źródła

更新card_list返回格式

AnlaAnla 3 tygodni temu
rodzic
commit
2eff8d7490
2 zmienionych plików z 6 dodań i 6 usunięć
  1. 4 4
      app/crud/crud_card.py
  2. 2 2
      app/utils/scheme.py

+ 4 - 4
app/crud/crud_card.py

@@ -134,8 +134,8 @@ def get_card_list_with_images(
         for card in cards:
             # 初始化新的字典字段
             card['image_path_list'] = {}
-            card['detection_image_path'] = {}
-            card['modified_image_path'] = {}
+            card['detection_image_path_list'] = {}
+            card['modified_image_path_list'] = {}
 
             # 获取与当前卡牌关联的所有图片记录
             related_images = images_by_card_id.get(card['id'], [])
@@ -145,7 +145,7 @@ def get_card_list_with_images(
                 image_type = image_data['image_type']  # e.g., 'front_face'
                 if image_type:  # 确保 image_type 不为空
                     card['image_path_list'][image_type] = image_data.get('image_path')
-                    card['detection_image_path'][image_type] = image_data.get('detection_image_path')
-                    card['modified_image_path'][image_type] = image_data.get('modified_image_path')
+                    card['detection_image_path_list'][image_type] = image_data.get('detection_image_path')
+                    card['modified_image_path_list'][image_type] = image_data.get('modified_image_path')
 
         return cards

+ 2 - 2
app/utils/scheme.py

@@ -143,8 +143,8 @@ class CardListDetailResponse(BaseModel):
     created_at: datetime
     updated_at: datetime
     image_path_list: Dict[str, Optional[str]] = {}
-    detection_image_path: Dict[str, Optional[str]] = {}
-    modified_image_path: Dict[str, Optional[str]] = {}
+    detection_image_path_list: Dict[str, Optional[str]] = {}
+    modified_image_path_list: Dict[str, Optional[str]] = {}
 
     class Config:
         from_attributes = True