push service
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "PushSubscription" (
|
||||
"id" UUID NOT NULL DEFAULT uuidv7(),
|
||||
"endpoint" VARCHAR NOT NULL,
|
||||
"expirationTime" DOUBLE PRECISION,
|
||||
"userSubscriptionId" UUID,
|
||||
"p256dh" VARCHAR NOT NULL,
|
||||
"auth" VARCHAR NOT NULL,
|
||||
"userId" VARCHAR NOT NULL,
|
||||
|
||||
CONSTRAINT "PushSubscription_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "PushSubscription_userSubscriptionId_key" ON "PushSubscription"("userSubscriptionId");
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `userSubscriptionId` on the `PushSubscription` table. All the data in the column will be lost.
|
||||
- Added the required column `clientId` to the `PushSubscription` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `topic` to the `PushSubscription` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- DropIndex
|
||||
DROP INDEX "PushSubscription_userSubscriptionId_key";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "PushSubscription" DROP COLUMN "userSubscriptionId",
|
||||
ADD COLUMN "clientId" UUID NOT NULL,
|
||||
ADD COLUMN "topic" "Topic" NOT NULL,
|
||||
ADD COLUMN "topicConfiguration" JSONB;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "User" (
|
||||
"id" VARCHAR NOT NULL,
|
||||
|
||||
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "PushSubscription" ADD CONSTRAINT "PushSubscription_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
@@ -21,7 +21,7 @@ model Member {
|
||||
kontakt String? @db.VarChar
|
||||
kuendigungzum DateTime? @db.Date
|
||||
marker Boolean?
|
||||
creationDate DateTime? @db.Date @default(now())
|
||||
creationDate DateTime? @default(now()) @db.Date
|
||||
}
|
||||
|
||||
model session {
|
||||
@@ -37,13 +37,13 @@ enum Topic {
|
||||
}
|
||||
|
||||
model FoundEvents {
|
||||
id String @id @default(dbgenerated("uuidv7()")) @db.Uuid
|
||||
source String @db.VarChar
|
||||
url String @db.VarChar
|
||||
foundDate DateTime @db.Date @default(now())
|
||||
eventDate String? @db.VarChar
|
||||
title String? @db.VarChar
|
||||
description String? @db.VarChar
|
||||
id String @id @default(dbgenerated("uuidv7()")) @db.Uuid
|
||||
source String @db.VarChar
|
||||
url String @db.VarChar
|
||||
foundDate DateTime @default(now()) @db.Date
|
||||
eventDate String? @db.VarChar
|
||||
title String? @db.VarChar
|
||||
description String? @db.VarChar
|
||||
attachedFiles FoundEventAttachments[]
|
||||
}
|
||||
|
||||
@@ -53,3 +53,24 @@ model FoundEventAttachments {
|
||||
event FoundEvents @relation(fields: [eventId], references: [id])
|
||||
eventId String @db.Uuid
|
||||
}
|
||||
|
||||
model PushSubscription {
|
||||
id String @id @default(dbgenerated("uuidv7()")) @db.Uuid
|
||||
endpoint String @db.VarChar
|
||||
expirationTime Float?
|
||||
p256dh String @db.VarChar
|
||||
auth String @db.VarChar
|
||||
|
||||
userId String @db.VarChar
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
|
||||
topic Topic
|
||||
topicConfiguration Json? @db.JsonB
|
||||
clientId String @db.Uuid
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @db.VarChar @id
|
||||
subscriptions PushSubscription[]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user