feat: implement pwa push notifications

This commit is contained in:
2026-01-13 09:03:46 +01:00
parent e7291951d8
commit 14430b275e
16 changed files with 547 additions and 50 deletions

View File

@@ -0,0 +1,13 @@
-- CreateTable
CREATE TABLE "PushSubscription" (
"id" TEXT NOT NULL PRIMARY KEY,
"planId" TEXT NOT NULL,
"endpoint" TEXT NOT NULL,
"p256dh" TEXT NOT NULL,
"auth" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "PushSubscription_planId_fkey" FOREIGN KEY ("planId") REFERENCES "Plan" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
-- CreateIndex
CREATE UNIQUE INDEX "PushSubscription_endpoint_key" ON "PushSubscription"("endpoint");

View File

@@ -21,6 +21,7 @@ model Plan {
litterInterval Int @default(2)
createdAt DateTime @default(now())
bookings Booking[]
pushSubscriptions PushSubscription[]
}
model Booking {
@@ -35,3 +36,13 @@ model Booking {
@@unique([planId, date, sitterName])
}
model PushSubscription {
id String @id @default(cuid())
planId String
plan Plan @relation(fields: [planId], references: [id], onDelete: Cascade)
endpoint String @unique
p256dh String
auth String
createdAt DateTime @default(now())
}