feat(push): add phase7 offline push queue, worker, APIs, and simulator inbox

This commit is contained in:
2026-01-24 15:20:00 +00:00
parent bccc049fc3
commit 6d6c77f77e
9 changed files with 392 additions and 6 deletions

View File

@@ -0,0 +1,17 @@
CREATE TABLE "push_notifications" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"owner_user_id" uuid NOT NULL,
"recipient_device_id" uuid NOT NULL,
"type" varchar(64) NOT NULL,
"payload" jsonb DEFAULT 'null'::jsonb,
"status" varchar(32) DEFAULT 'queued' NOT NULL,
"attempts" integer DEFAULT 0 NOT NULL,
"last_error" text,
"sent_at" timestamp with time zone,
"next_attempt_at" timestamp with time zone DEFAULT now() NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "push_notifications" ADD CONSTRAINT "push_notifications_owner_user_id_users_id_fk" FOREIGN KEY ("owner_user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "push_notifications" ADD CONSTRAINT "push_notifications_recipient_device_id_devices_id_fk" FOREIGN KEY ("recipient_device_id") REFERENCES "public"."devices"("id") ON DELETE no action ON UPDATE no action;

View File

@@ -71,6 +71,13 @@
"when": 1770416956419,
"tag": "0009_recordings_pipeline",
"breakpoints": true
},
{
"idx": 10,
"version": "7",
"when": 1770417956419,
"tag": "0010_push_notifications_queue",
"breakpoints": true
}
]
}