add push settings

This commit is contained in:
lendry
2026-07-07 13:58:01 +03:00
parent 1bd95fa99e
commit 57925fb2c4
25 changed files with 3036 additions and 1756 deletions

View File

@@ -0,0 +1,24 @@
-- CreateEnum
CREATE TYPE "PushPlatform" AS ENUM ('WEB', 'ANDROID', 'IOS');
-- CreateTable
CREATE TABLE "PushDeviceToken" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"token" TEXT NOT NULL,
"platform" "PushPlatform" NOT NULL DEFAULT 'WEB',
"deviceLabel" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "PushDeviceToken_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "PushDeviceToken_token_key" ON "PushDeviceToken"("token");
-- CreateIndex
CREATE INDEX "PushDeviceToken_userId_idx" ON "PushDeviceToken"("userId");
-- AddForeignKey
ALTER TABLE "PushDeviceToken" ADD CONSTRAINT "PushDeviceToken_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@@ -40,6 +40,12 @@ enum AppReleasePlatform {
WINDOWS
}
enum PushPlatform {
WEB
ANDROID
IOS
}
model AppRelease {
id String @id @default(uuid())
platform AppReleasePlatform
@@ -104,6 +110,7 @@ model User {
sentFamilyInvites FamilyInvite[] @relation("FamilyInviteInviter")
receivedFamilyInvites FamilyInvite[] @relation("FamilyInviteInvitee")
notifications Notification[]
pushDeviceTokens PushDeviceToken[]
chatRoomMembers ChatRoomMember[]
chatMessages ChatMessage[]
chatPollVotes ChatPollVote[]
@@ -437,6 +444,19 @@ model Notification {
@@index([userId, isRead, createdAt])
}
model PushDeviceToken {
id String @id @default(uuid())
userId String
token String @unique
platform PushPlatform @default(WEB)
deviceLabel String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@index([userId])
}
model ChatRoom {
id String @id @default(uuid())
groupId String