mirror of
https://github.com/documenso/documenso.git
synced 2026-07-26 01:45:08 +10:00
fix: add multi email transport system (#2942)
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
-- CreateEnum
|
||||
CREATE TYPE "EmailTransportType" AS ENUM ('SMTP_AUTH', 'SMTP_API', 'RESEND', 'MAILCHANNELS');
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "OrganisationClaim" ADD COLUMN "emailTransportId" TEXT;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "SubscriptionClaim" ADD COLUMN "emailTransportId" TEXT;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "EmailTransport" (
|
||||
"id" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"type" "EmailTransportType" NOT NULL,
|
||||
"fromName" TEXT NOT NULL,
|
||||
"fromAddress" TEXT NOT NULL,
|
||||
"config" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "EmailTransport_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "SubscriptionClaim" ADD CONSTRAINT "SubscriptionClaim_emailTransportId_fkey" FOREIGN KEY ("emailTransportId") REFERENCES "EmailTransport"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "OrganisationClaim" ADD CONSTRAINT "OrganisationClaim_emailTransportId_fkey" FOREIGN KEY ("emailTransportId") REFERENCES "EmailTransport"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -280,6 +280,9 @@ model SubscriptionClaim {
|
||||
|
||||
apiRateLimits Json /// [RateLimitArray] @zod.custom.use(ZRateLimitArraySchema)
|
||||
apiQuota Int?
|
||||
|
||||
emailTransportId String?
|
||||
emailTransport EmailTransport? @relation(fields: [emailTransportId], references: [id], onDelete: SetNull)
|
||||
}
|
||||
|
||||
/// @zod.import(["import { ZClaimFlagsSchema, ZRateLimitArraySchema } from '@documenso/lib/types/subscription';"])
|
||||
@@ -306,6 +309,9 @@ model OrganisationClaim {
|
||||
|
||||
apiRateLimits Json /// [RateLimitArray] @zod.custom.use(ZRateLimitArraySchema)
|
||||
apiQuota Int?
|
||||
|
||||
emailTransportId String?
|
||||
emailTransport EmailTransport? @relation(fields: [emailTransportId], references: [id], onDelete: SetNull)
|
||||
}
|
||||
|
||||
model OrganisationMonthlyStat {
|
||||
@@ -1136,6 +1142,32 @@ model OrganisationEmail {
|
||||
teamGlobalSettings TeamGlobalSettings[]
|
||||
}
|
||||
|
||||
enum EmailTransportType {
|
||||
SMTP_AUTH
|
||||
SMTP_API
|
||||
RESEND
|
||||
MAILCHANNELS
|
||||
}
|
||||
|
||||
model EmailTransport {
|
||||
id String @id
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
name String
|
||||
type EmailTransportType
|
||||
|
||||
// Required from-address override (plaintext, non-secret).
|
||||
fromName String
|
||||
fromAddress String
|
||||
|
||||
// Encrypted JSON blob of the full transport config (secrets + non-secrets).
|
||||
config String
|
||||
|
||||
subscriptionClaims SubscriptionClaim[]
|
||||
organisationClaims OrganisationClaim[]
|
||||
}
|
||||
|
||||
model OrganisationAuthenticationPortal {
|
||||
id String @id
|
||||
organisation Organisation?
|
||||
|
||||
Reference in New Issue
Block a user