Upload 81 files
Browse files
backend/routers/catalog.py
CHANGED
|
@@ -94,9 +94,9 @@ _SEED = [
|
|
| 94 |
],
|
| 95 |
"url_detalle": "https://heyzine.com/flip-book/447fe3eb8e.html#page/38",
|
| 96 |
"productos": [
|
| 97 |
-
{"id": "DECK_madera", "nombre": "Deck Madera", "textura": "
|
| 98 |
-
{"id": "DECK_madera_oscuro", "nombre": "Deck Madera Oscuro", "textura": "
|
| 99 |
-
{"id": "DECK_gris", "nombre": "Deck Gris", "textura": "
|
| 100 |
],
|
| 101 |
"created_at": "2026-05-08T00:00:00Z",
|
| 102 |
},
|
|
@@ -110,10 +110,11 @@ async def seed_catalog() -> None:
|
|
| 110 |
await col.insert_many(_SEED)
|
| 111 |
return
|
| 112 |
|
| 113 |
-
#
|
| 114 |
for seed_item in _SEED:
|
| 115 |
doc = await col.find_one({"_id": seed_item["_id"]})
|
| 116 |
if not doc:
|
|
|
|
| 117 |
continue
|
| 118 |
patch = {k: v for k, v in seed_item.items() if k not in doc and k != "_id"}
|
| 119 |
if patch:
|
|
|
|
| 94 |
],
|
| 95 |
"url_detalle": "https://heyzine.com/flip-book/447fe3eb8e.html#page/38",
|
| 96 |
"productos": [
|
| 97 |
+
{"id": "DECK_madera", "nombre": "Deck Madera", "textura": "Texture_WPC_DECK/DECK_madera.png", "url_preview": "/seg/texture-preview/Texture_WPC_DECK/DECK_madera.png", "dimensiones": ["2.90x0.14"]},
|
| 98 |
+
{"id": "DECK_madera_oscuro", "nombre": "Deck Madera Oscuro", "textura": "Texture_WPC_DECK/DECK_madera_oscuro.png", "url_preview": "/seg/texture-preview/Texture_WPC_DECK/DECK_madera_oscuro.png", "dimensiones": ["2.90x0.14"]},
|
| 99 |
+
{"id": "DECK_gris", "nombre": "Deck Gris", "textura": "Texture_WPC_DECK/DECK_gris.png", "url_preview": "/seg/texture-preview/Texture_WPC_DECK/DECK_gris.png", "dimensiones": ["2.90x0.14"]},
|
| 100 |
],
|
| 101 |
"created_at": "2026-05-08T00:00:00Z",
|
| 102 |
},
|
|
|
|
| 110 |
await col.insert_many(_SEED)
|
| 111 |
return
|
| 112 |
|
| 113 |
+
# Insertar entradas nuevas del seed y parchar campos faltantes en las existentes
|
| 114 |
for seed_item in _SEED:
|
| 115 |
doc = await col.find_one({"_id": seed_item["_id"]})
|
| 116 |
if not doc:
|
| 117 |
+
await col.insert_one(dict(seed_item))
|
| 118 |
continue
|
| 119 |
patch = {k: v for k, v in seed_item.items() if k not in doc and k != "_id"}
|
| 120 |
if patch:
|