[object Object]

← back to All Designerwallcoverings

all.dw internal tool: default scope = all-but-archived (incl. Staged/DRAFT); fold DELETED_FROM_SHOPIFY into Archived

2ac9b38626dedf461a5818c13e9d50d2bea76750 · 2026-07-08 09:16:36 -0700 · steve

Files touched

Diff

commit 2ac9b38626dedf461a5818c13e9d50d2bea76750
Author: steve <steve@designerwallcoverings.com>
Date:   Wed Jul 8 09:16:36 2026 -0700

    all.dw internal tool: default scope = all-but-archived (incl. Staged/DRAFT); fold DELETED_FROM_SHOPIFY into Archived
---
 server.js | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/server.js b/server.js
index a57351e..1f10c1e 100644
--- a/server.js
+++ b/server.js
@@ -167,8 +167,10 @@ async function snapSql() {
          ${priceExpr} AS price,
          ${pubExpr} AS online_store_published,
          created_at_shopify, updated_at_shopify
-  FROM shopify_products
-  WHERE coalesce(status,'') <> 'DELETED_FROM_SHOPIFY'`;
+  FROM shopify_products`;
+  // NOTE: DELETED_FROM_SHOPIFY rows are now LOADED and mapped to the 'Archived'
+  // lifecycle (Steve 2026-07-08: "they should be archived"), not excluded outright —
+  // so they're classified honestly and reachable only under the Archived filter.
 }
 
 let ROWS = [];
@@ -265,7 +267,7 @@ function deriveRow(r) {
   // "Active on site" only when the ACTIVE product is actually published to the Online
   // Store — Shopify status and sales-channel publish state are orthogonal, so an
   // ACTIVE-but-unpublished SKU (never went live) reads as Staged, same as a DRAFT.
-  const lifecycle = r.status === 'ARCHIVED' ? 'Archived'
+  const lifecycle = (r.status === 'ARCHIVED' || r.status === 'DELETED_FROM_SHOPIFY') ? 'Archived'
     : r.status === 'DRAFT' ? 'Staged'
     : (r.status === 'ACTIVE' && r.online_store_published) ? 'Active on site'
     : 'Staged';
@@ -367,12 +369,15 @@ function parseFilters(u) {
     prices: csv('prices'), images: csv('images'),
   };
 }
-// Default scope = live-on-site unless the user explicitly picked lifecycle buckets.
+// Default scope = EVERYTHING EXCEPT ARCHIVED. all.dw is the INTERNAL "find any item in
+// the market" tool (Steve 2026-07-08) — it must surface every product that exists,
+// incl. Staged/DRAFT that DW doesn't publish on the customer store; only Archived
+// (which now includes DELETED_FROM_SHOPIFY) is hidden by default.
 function applyFilters(rows, f, opts = {}) {
   let out = rows;
   if (opts.skip !== 'lifecycle') {
     out = f.lifecycles.size ? out.filter((r) => f.lifecycles.has(r.lifecycle))
-                            : out.filter((r) => r.lifecycle === 'Active on site');
+                            : out.filter((r) => r.lifecycle !== 'Archived');
   }
   if (f.q) {
     // word-START match per term so "red" hits "Red"/"redwood" but not "weatheRED"/"bordeRED"

← 02ea04b env-ify Basic-Auth: support BASIC_AUTH_USER/PASS, default un  ·  back to All Designerwallcoverings  ·  Stop tracking data/backfills/ ops artifacts; gitignore the d 949b520 →