add import messages/calls ui feedback

This commit is contained in:
m5r
2021-09-25 07:07:40 +08:00
parent 8f0a6f7060
commit 2f45e1d9a8
14 changed files with 153 additions and 16 deletions

View File

@ -0,0 +1,19 @@
-- CreateTable
CREATE TABLE "ProcessingPhoneNumber" (
"createdAt" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
"hasFetchedMessages" BOOLEAN NOT NULL,
"hasFetchedCalls" BOOLEAN NOT NULL,
"phoneNumberId" TEXT NOT NULL,
"organizationId" TEXT NOT NULL,
PRIMARY KEY ("organizationId","phoneNumberId")
);
-- CreateIndex
CREATE UNIQUE INDEX "ProcessingPhoneNumber_phoneNumberId_unique" ON "ProcessingPhoneNumber"("phoneNumberId");
-- AddForeignKey
ALTER TABLE "ProcessingPhoneNumber" ADD FOREIGN KEY ("phoneNumberId") REFERENCES "PhoneNumber"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ProcessingPhoneNumber" ADD FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -31,6 +31,7 @@ model Organization {
notificationSubscriptions NotificationSubscription[]
messages Message[]
phoneCalls PhoneCall[]
processingPhoneNumbers ProcessingPhoneNumber[]
@@unique([id, twilioAccountSid])
}
@ -194,12 +195,25 @@ model PhoneNumber {
phoneCalls PhoneCall[]
notificationSubscriptions NotificationSubscription[]
organization Organization @relation(fields: [organizationId], references: [id])
organizationId String
processingPhoneNumber ProcessingPhoneNumber?
organization Organization @relation(fields: [organizationId], references: [id])
organizationId String
@@unique([organizationId, id])
}
model ProcessingPhoneNumber {
createdAt DateTime @default(now()) @db.Timestamptz
hasFetchedMessages Boolean
hasFetchedCalls Boolean
phoneNumber PhoneNumber @relation(fields: [phoneNumberId], references: [id])
phoneNumberId String
organization Organization @relation(fields: [organizationId], references: [id])
organizationId String
@@id([organizationId, phoneNumberId])
}
model NotificationSubscription {
id String @id @default(uuid())
createdAt DateTime @default(now()) @db.Timestamptz