Icon rebuilt as a full-bleed 1200x1200 square (Shopify rounds corners itself). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import type { ActionFunctionArgs } from "react-router";
|
|
import { authenticate } from "../shopify.server";
|
|
import db from "../db.server";
|
|
|
|
// Mandatory GDPR webhooks. Offerlyst stores no customer personal data: only order ids, order names and
|
|
// amounts for analytics (no names, emails or addresses). customers/data_request and customers/redact have
|
|
// nothing to return or erase; shop/redact (48 h after uninstall) deletes everything about the shop.
|
|
export const action = async ({ request }: ActionFunctionArgs) => {
|
|
const { shop, topic } = await authenticate.webhook(request);
|
|
switch (topic) {
|
|
case "CUSTOMERS_DATA_REQUEST":
|
|
case "CUSTOMERS_REDACT":
|
|
break;
|
|
case "SHOP_REDACT": {
|
|
const row = await db.shop.findUnique({ where: { domain: shop }, select: { id: true } });
|
|
if (row) {
|
|
await db.orderStat.deleteMany({ where: { shopId: row.id } });
|
|
await db.shop.delete({ where: { id: row.id } }); // cascades to offers, usage and audit log
|
|
}
|
|
await db.session.deleteMany({ where: { shop } });
|
|
break;
|
|
}
|
|
default:
|
|
return new Response("Unhandled topic", { status: 404 });
|
|
}
|
|
return new Response();
|
|
};
|