cairn work

This commit is contained in:
Michael Freno
2026-01-21 01:56:40 -05:00
parent 0d006e8260
commit 5fc082178c
12 changed files with 1716 additions and 4 deletions

View File

@@ -0,0 +1,25 @@
import type { APIEvent } from "@solidjs/start/server";
import { verifyAppleNotification } from "~/server/apple-notification";
import { storeAppleNotificationUser } from "~/server/apple-notification-store";
export async function POST(event: APIEvent) {
const contentType = event.request.headers.get("content-type") || "";
if (!contentType.includes("application/json")) {
return new Response("Unsupported content type", { status: 415 });
}
try {
const payload = await event.request.json();
const notification = await verifyAppleNotification(payload);
await storeAppleNotificationUser(notification);
return new Response(JSON.stringify({ success: true }), {
status: 200,
headers: { "Content-Type": "application/json" }
});
} catch (error) {
console.error("Apple notification error:", error);
return new Response("Notification processing failed", { status: 400 });
}
}