← back to Dw Vendor Microsites
lib/export-zuber-local.sh
32 lines
#!/usr/bin/env bash
# export-zuber-local.sh — LOCAL export of zuber_catalog to staging/zuber.jsonl
# (Zuber lives in LOCAL dw_unified, not Kamatera; and is a public brand so no
# private-label scrub is needed. Normalizes to the viewer engine's shape.)
set -euo pipefail
REPO="$(cd "$(dirname "$0")/.." && pwd)"
OUT="${1:-$REPO/staging/zuber.jsonl}"
mkdir -p "$(dirname "$OUT")"
psql "${PGURI:-postgresql://localhost/dw_unified}" -tAc "
SELECT json_build_object(
'mfr_sku', mfr_sku,
'dw_sku', dw_sku,
'pattern_name', pattern_name,
'color_name', color_name,
'collection', collection,
'product_type', product_type,
'material', material,
'width', width,
'image_url', image_url,
'all_images', all_images,
'product_url', product_url,
'description', coalesce(description, ai_description),
'ai_colors', ai_colors,
'ai_styles', ai_styles,
'ai_patterns', ai_patterns,
'color_hex', color_hex,
'line', collection
)::text
FROM zuber_catalog ORDER BY id;
" > "$OUT"
echo "exported $(wc -l < "$OUT") rows -> $OUT"