← back to Designer Wallcoverings
Create Phillipe Romano 'Abruzzo Natural Collection' (368 WallQuest->PR natural textiles)
cd7214e52cae4660b12b98e0aeeefdce28faaa75 · 2026-07-06 16:00:15 -0700 · Steve
Files touched
A scripts/wallquest-refresh/create-abruzzo-collection.cjs
Diff
commit cd7214e52cae4660b12b98e0aeeefdce28faaa75
Author: Steve <steve@designerwallcoverings.com>
Date: Mon Jul 6 16:00:15 2026 -0700
Create Phillipe Romano 'Abruzzo Natural Collection' (368 WallQuest->PR natural textiles)
---
.../create-abruzzo-collection.cjs | 57 ++++++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/scripts/wallquest-refresh/create-abruzzo-collection.cjs b/scripts/wallquest-refresh/create-abruzzo-collection.cjs
new file mode 100644
index 00000000..b64867a7
--- /dev/null
+++ b/scripts/wallquest-refresh/create-abruzzo-collection.cjs
@@ -0,0 +1,57 @@
+// Create Phillipe Romano "Abruzzo Natural Collection" and add all WallQuest->PR natural-textile
+// products (Daisy Bennett V1+V2, Lillian August, Carl Robinson, Paper & Ink clean textiles).
+// Manual collection + collectionAddProducts (batched). Idempotent-ish: reuses existing collection by title.
+const fs = require('fs');
+const https = require('https');
+const { Client } = require('pg');
+const STORE = 'designer-laboratory-sandbox.myshopify.com';
+const TOKEN = process.env.SHOPIFY_ADMIN_TOKEN;
+if (!TOKEN) { console.error('no SHOPIFY_ADMIN_TOKEN'); process.exit(1); }
+const CONN = process.env.DATABASE_URL || 'postgresql://dw_admin@127.0.0.1:5432/dw_unified';
+const TITLE = 'Abruzzo Natural Collection';
+const sleep = ms => new Promise(r => setTimeout(r, ms));
+
+function gql(query, variables) {
+ return new Promise((res, rej) => { const body = JSON.stringify({ query, variables });
+ const req = https.request({ hostname: STORE, path: '/admin/api/2024-10/graphql.json', method: 'POST',
+ headers: { 'X-Shopify-Access-Token': TOKEN, 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(body) }, timeout: 40000 },
+ r => { let d=''; r.on('data',c=>d+=c); r.on('end',()=>{ try{res(JSON.parse(d));}catch(e){rej(e);} }); });
+ req.on('error', rej); req.write(body); req.end(); });
+}
+
+(async () => {
+ const db = new Client({ connectionString: CONN }); await db.connect();
+ // brand-scoped product ids
+ const piSkus = JSON.parse(fs.readFileSync('/tmp/pi-PR-drafts-clean.json', 'utf8')).map(d => d.dw_sku);
+ const { rows } = await db.query(
+ `SELECT DISTINCT shopify_product_id FROM dw_sku_registry
+ WHERE shopify_product_id IS NOT NULL AND (
+ mfr_sku ~ '^DB[0-9]' OR mfr_sku ~ '^BX' OR mfr_sku ~ '^LN[0-9]' OR mfr_sku ~ '^CL[0-9]'
+ OR dw_sku = ANY($1))`, [piSkus]);
+ const gids = rows.map(r => `gid://shopify/Product/${r.shopify_product_id}`);
+ console.log(`products to add: ${gids.length}`);
+
+ // find or create the collection
+ const found = await gql(`{ collections(first:5, query:"title:'${TITLE}'"){edges{node{id title}}} }`);
+ let cid = found.data?.collections?.edges?.find(e => e.node.title === TITLE)?.node?.id;
+ if (!cid) {
+ const c = await gql(`mutation($in:CollectionInput!){ collectionCreate(input:$in){ collection{id title} userErrors{message} } }`,
+ { in: { title: TITLE, descriptionHtml: '<p>A curated Phillipe Romano collection of natural woven textiles — grasscloth, sisal, paperweave, raffia, abaca, jute and cork — sold per yard in 8-yard bolts.</p>' } });
+ if (c.data?.collectionCreate?.userErrors?.length) { console.error('create err', JSON.stringify(c.data.collectionCreate.userErrors)); process.exit(1); }
+ cid = c.data.collectionCreate.collection.id;
+ console.log(`created collection ${cid}`);
+ } else { console.log(`reusing existing collection ${cid}`); }
+
+ // add products in batches of 200
+ let added = 0, err = 0;
+ for (let i = 0; i < gids.length; i += 200) {
+ const batch = gids.slice(i, i + 200);
+ const r = await gql(`mutation($id:ID!,$ids:[ID!]!){ collectionAddProducts(id:$id, productIds:$ids){ userErrors{message} } }`, { id: cid, ids: batch });
+ const e = r.errors || r.data?.collectionAddProducts?.userErrors?.length;
+ if (e) { err += batch.length; console.error(` batch ${i} err:`, JSON.stringify(r.errors || r.data.collectionAddProducts.userErrors).slice(0, 160)); }
+ else { added += batch.length; console.log(` +${batch.length} (total ${added})`); }
+ await sleep(800);
+ }
+ console.log(`\nABRUZZO NATURAL COLLECTION — added=${added} err=${err} · collection ${cid}`);
+ await db.end();
+})().catch(e => { console.error('FATAL', e.message); process.exit(1); });
← 63611c9a LN colorway decollapse tool (image-hex → distinct names)
·
back to Designer Wallcoverings
·
Backfill images for 92 imageless Lillian August veneers (Bro de1e2564 →