Setting up more printful logic. Setting up db.

This commit is contained in:
Dominic Ferrando
2025-05-03 13:54:55 -04:00
parent 6cd2d72fc5
commit bb7c041c48
8 changed files with 233 additions and 1 deletions
+33 -1
View File
@@ -1 +1,33 @@
console.log("Hello world");
import { Printful } from "./printful.ts"
import { ProductRecords } from "./storage.ts"
const productRecords = new ProductRecords();
const server = Bun.serve({
routes: {
"/webhook/printful": {
async POST(req) {
const payload: Printful.Webhook.EventPayload = await req.json()
switch (payload.type) {
case Printful.Webhook.Event.ProductUpdated:
const productRecord = productRecords.findFromPrintful(payload.data.sync_product.id)
if (productRecord) {
}
else {
}
break;
case Printful.Webhook.Event.ProductDeleted:
break;
}
return Response.json("Hello world")
}
}
},
development: true
})
console.log(`Listening on ${server.url}`);