Rust discount function (one automatic discount evaluating all offers in priority order, parity with the Odoo engine), React Router admin with Polaris, theme app extension and app proxy pages, webhooks incl. GDPR, managed-pricing limits, and a Docker Compose stack (Postgres + Caddy HTTPS) for a single VPS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
22 lines
645 B
TypeScript
22 lines
645 B
TypeScript
import type { ActionFunctionArgs } from "react-router";
|
|
import { authenticate } from "../shopify.server";
|
|
import db from "../db.server";
|
|
|
|
export const action = async ({ request }: ActionFunctionArgs) => {
|
|
const { payload, session, topic, shop } = await authenticate.webhook(request);
|
|
console.log(`Received ${topic} webhook for ${shop}`);
|
|
|
|
const current = payload.current as string[];
|
|
if (session) {
|
|
await db.session.update({
|
|
where: {
|
|
id: session.id
|
|
},
|
|
data: {
|
|
scope: current.toString(),
|
|
},
|
|
});
|
|
}
|
|
return new Response();
|
|
};
|