- Updated the NotificationsModule to enhance notification management for user actions and events. - Improved integration with the CheckoutRegistrationService to streamline SIM order notifications. - Refactored CatalogCdcSubscriber to ensure timely creation of notifications for account status changes. - Enhanced frontend components to better display notification alerts, improving user experience and accessibility.
41 lines
1.6 KiB
SQL
41 lines
1.6 KiB
SQL
-- CreateEnum
|
|
CREATE TYPE "NotificationType" AS ENUM ('ELIGIBILITY_ELIGIBLE', 'ELIGIBILITY_INELIGIBLE', 'VERIFICATION_VERIFIED', 'VERIFICATION_REJECTED', 'ORDER_APPROVED', 'ORDER_ACTIVATED', 'ORDER_FAILED', 'CANCELLATION_SCHEDULED', 'CANCELLATION_COMPLETE', 'PAYMENT_METHOD_EXPIRING', 'INVOICE_DUE', 'SYSTEM_ANNOUNCEMENT');
|
|
|
|
-- CreateEnum
|
|
CREATE TYPE "NotificationSource" AS ENUM ('SALESFORCE', 'WHMCS', 'PORTAL', 'SYSTEM');
|
|
|
|
-- AlterTable
|
|
ALTER TABLE "residence_card_submissions" ALTER COLUMN "updated_at" DROP DEFAULT;
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "notifications" (
|
|
"id" TEXT NOT NULL,
|
|
"user_id" TEXT NOT NULL,
|
|
"type" "NotificationType" NOT NULL,
|
|
"title" TEXT NOT NULL,
|
|
"message" TEXT,
|
|
"action_url" TEXT,
|
|
"action_label" TEXT,
|
|
"source" "NotificationSource" NOT NULL DEFAULT 'SALESFORCE',
|
|
"source_id" TEXT,
|
|
"read" BOOLEAN NOT NULL DEFAULT false,
|
|
"read_at" TIMESTAMP(3),
|
|
"dismissed" BOOLEAN NOT NULL DEFAULT false,
|
|
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"expires_at" TIMESTAMP(3) NOT NULL,
|
|
|
|
CONSTRAINT "notifications_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "notifications_user_id_read_dismissed_idx" ON "notifications"("user_id", "read", "dismissed");
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "notifications_user_id_created_at_idx" ON "notifications"("user_id", "created_at");
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "notifications_expires_at_idx" ON "notifications"("expires_at");
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "notifications" ADD CONSTRAINT "notifications_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|