feat(backend): Benachrichtigungssystem (Modul 26)
NotificationsModule: Notification-Modell mit Prioritaeten INFO/ HINWEIS/WARNUNG/KRITISCH, GET /notifications (eigene + Broadcast), POST /notifications/:id/read. record() als interne API fuer kuenftige Automatisierungsregeln (Modul 30) vorgesehen.
This commit is contained in:
1 parent
9b078022ff
commit
a57cde1f9a
9 files changed
+299
-1
No files matched your search
@@ -0,0 +1,25 @@
|
||||
-- CreateEnum
|
||||
CREATE TYPE "NotificationPriority" AS ENUM ('INFO', 'HINWEIS', 'WARNUNG', 'KRITISCH');
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Notification" (
|
||||
"id" TEXT NOT NULL,
|
||||
"userId" TEXT,
|
||||
"priority" "NotificationPriority" NOT NULL,
|
||||
"message" TEXT NOT NULL,
|
||||
"relatedType" TEXT,
|
||||
"relatedId" TEXT,
|
||||
"read" BOOLEAN NOT NULL DEFAULT false,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "Notification_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "Notification_userId_read_idx" ON "Notification"("userId", "read");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "Notification_priority_idx" ON "Notification"("priority");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Notification" ADD CONSTRAINT "Notification_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
Reference in new issue
Block a user