send notification when sms arrives
This commit is contained in:
@ -0,0 +1,16 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "NotificationSubscription" (
|
||||
"id" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMPTZ NOT NULL,
|
||||
"endpoint" TEXT NOT NULL,
|
||||
"expirationTime" INTEGER,
|
||||
"keys_p256dh" TEXT NOT NULL,
|
||||
"keys_auth" TEXT NOT NULL,
|
||||
"customerId" TEXT NOT NULL,
|
||||
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "NotificationSubscription" ADD FOREIGN KEY ("customerId") REFERENCES "Customer"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
@ -0,0 +1,8 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[endpoint]` on the table `NotificationSubscription` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "NotificationSubscription.endpoint_unique" ON "NotificationSubscription"("endpoint");
|
@ -77,10 +77,11 @@ model Customer {
|
||||
paddleCustomerId String?
|
||||
paddleSubscriptionId String?
|
||||
|
||||
user User @relation(fields: [id], references: [id])
|
||||
messages Message[]
|
||||
phoneCalls PhoneCall[]
|
||||
phoneNumbers PhoneNumber[]
|
||||
user User @relation(fields: [id], references: [id])
|
||||
messages Message[]
|
||||
phoneCalls PhoneCall[]
|
||||
phoneNumbers PhoneNumber[]
|
||||
notificationSubscriptions NotificationSubscription[]
|
||||
}
|
||||
|
||||
model Message {
|
||||
@ -152,3 +153,16 @@ model PhoneNumber {
|
||||
customer Customer @relation(fields: [customerId], references: [id])
|
||||
customerId String
|
||||
}
|
||||
|
||||
model NotificationSubscription {
|
||||
id String @id @default(uuid())
|
||||
createdAt DateTime @default(now()) @db.Timestamptz
|
||||
updatedAt DateTime @updatedAt @db.Timestamptz
|
||||
endpoint String @unique
|
||||
expirationTime Int?
|
||||
keys_p256dh String
|
||||
keys_auth String
|
||||
|
||||
customer Customer @relation(fields: [customerId], references: [id])
|
||||
customerId String
|
||||
}
|
||||
|
Reference in New Issue
Block a user