Initial commit: sap-intercompany-worker

Motor de escenarios de replicacion entre bases SAP Business One
(Service Layer). Poll periodico sobre webhook_events, escenarios
configurables via Prisma (filter + transform por escenario).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
GeorgeandClaude Sonnet 5 committed 2026-09-16 07:45:57 -05:00
commit ca57403663
36 files changed
+5539

No files matched your search

@@ -0,0 +1,31 @@
-- CreateEnum
CREATE TYPE "EventStatus" AS ENUM ('pending', 'processing', 'done', 'partial', 'failed');
-- CreateTable
CREATE TABLE "webhook_events" (
"id" TEXT NOT NULL,
"business_object" TEXT NOT NULL,
"operation" TEXT NOT NULL,
"subject" TEXT NOT NULL,
"payload" JSONB NOT NULL,
"received_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"status" "EventStatus" NOT NULL DEFAULT 'pending',
CONSTRAINT "webhook_events_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "replication_attempts" (
"id" SERIAL NOT NULL,
"event_id" TEXT NOT NULL,
"subsidiary" TEXT NOT NULL,
"verb_used" TEXT NOT NULL,
"http_status" INTEGER,
"error_message" TEXT,
"attempted_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "replication_attempts_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "replication_attempts" ADD CONSTRAINT "replication_attempts_event_id_fkey" FOREIGN KEY ("event_id") REFERENCES "webhook_events"("id") ON DELETE RESTRICT ON UPDATE CASCADE;