metatrondelivery/app/routes/webhooks.shop.redact.tsx
metatroncubeswdev e6b8b710c4
Some checks failed
CI / Lint, Unit & Integration Tests (push) Has been cancelled
feat(phase-8): implement GDPR compliance webhook handlers
Replace the customers/data_request, customers/redact, and shop/redact
stubs with real logic in app/services/gdpr.server.ts: compile a
customer's Booking history, anonymize customerEmail/customerPhone on
redact, and purge every shopDomain-scoped row on shop uninstall
(Booking before Location, relying on Location's cascade for
SlotTemplate/SlotOverride/BlackoutDate/Zone/Rate). Covered by a new
tests/integration/gdpr.test.ts against live Postgres to verify the
FK deletion order actually works, not just typechecks.

Still commented out in shopify.app.toml pending Protected customer
data access approval in the Partner Dashboard — unrelated to code
readiness.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-24 09:20:16 -04:00

15 lines
519 B
TypeScript

import type { ActionFunctionArgs } from "@remix-run/node";
import { authenticate } from "../shopify.server";
import { purgeShopData } from "../services/gdpr.server";
// GDPR: shop uninstalled the app 48 hours ago — erase all shop data.
export const action = async ({ request }: ActionFunctionArgs) => {
const { shop, topic, payload } = await authenticate.webhook(request);
console.log(`[gdpr] ${topic} for ${shop} — purging all shop data`, payload);
await purgeShopData(shop);
return new Response();
};