courrier multi account restore compose

This commit is contained in:
alma 2025-04-28 12:19:10 +02:00
parent 6ac1f8c5af
commit cf0f724323
9 changed files with 525 additions and 115 deletions

View File

@ -153,6 +153,8 @@ export async function getUserEmailCredentials(userId: string): Promise<EmailCred
const credentials = await prisma.mailCredentials.findUnique({
where: { userId },
select: {
id: true,
userId: true,
email: true,
password: true,
host: true,
@ -162,7 +164,9 @@ export async function getUserEmailCredentials(userId: string): Promise<EmailCred
smtp_port: true,
smtp_secure: true,
display_name: true,
color: true
color: true,
createdAt: true,
updatedAt: true
}
});
@ -170,24 +174,10 @@ export async function getUserEmailCredentials(userId: string): Promise<EmailCred
return null;
}
// Create the credentials object
const emailCredentials: EmailCredentials = {
email: credentials.email,
password: credentials.password,
host: credentials.host,
port: credentials.port,
secure: credentials.secure ?? false,
smtp_host: credentials.smtp_host ?? undefined,
smtp_port: credentials.smtp_port ?? undefined,
smtp_secure: credentials.smtp_secure ?? undefined,
display_name: credentials.display_name ?? undefined,
color: credentials.color ?? undefined
};
// Cache the credentials
await cacheEmailCredentials(userId, [emailCredentials]);
await cacheEmailCredentials(userId, credentials);
return emailCredentials;
return credentials;
}
/**

View File

@ -1,20 +1,18 @@
export interface EmailCredentials {
// IMAP Settings
id: string;
userId: string;
email: string;
password?: string;
password: string;
host: string;
port: number;
secure?: boolean;
encryptedPassword?: string;
// SMTP Settings
smtp_host?: string;
smtp_port?: number;
smtp_secure?: boolean; // true for SSL, false for TLS
// Display Settings
display_name?: string;
color?: string;
secure: boolean;
smtp_host: string | null;
smtp_port: number | null;
smtp_secure: boolean | null;
display_name: string | null;
color: string | null;
createdAt: Date;
updatedAt: Date;
}
export interface EmailAddress {

12
node_modules/.prisma/client/edge.js generated vendored

File diff suppressed because one or more lines are too long

View File

@ -156,6 +156,12 @@ exports.Prisma.MailCredentialsScalarFieldEnum = {
password: 'password',
host: 'host',
port: 'port',
secure: 'secure',
smtp_host: 'smtp_host',
smtp_port: 'smtp_port',
smtp_secure: 'smtp_secure',
display_name: 'display_name',
color: 'color',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
};

File diff suppressed because it is too large Load Diff

12
node_modules/.prisma/client/index.js generated vendored

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
{
"name": "prisma-client-c9759cc7a8e2c5f5df4ff9bd3c0aee5a8c3b48f326a42a0aac248c95b4c1be3c",
"name": "prisma-client-b40f3f84d2de0618d89c499eb0cd716edd77eed705934b6086e165c44e903c03",
"main": "index.js",
"types": "index.d.ts",
"browser": "index-browser.js",

View File

@ -19,7 +19,7 @@ model User {
updatedAt DateTime @updatedAt
calendars Calendar[]
events Event[]
mailCredentials MailCredentials?
mailCredentials MailCredentials[]
webdavCredentials WebDAVCredentials?
}
@ -57,12 +57,23 @@ model Event {
}
model MailCredentials {
id String @id @default(uuid())
userId String @unique
email String
password String
host String
port Int
id String @id @default(uuid())
userId String
email String
password String
host String
port Int
secure Boolean @default(true)
// SMTP Settings
smtp_host String?
smtp_port Int?
smtp_secure Boolean? @default(false)
// Display Settings
display_name String?
color String? @default("#0082c9")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id], onDelete: Cascade)

View File

@ -156,6 +156,12 @@ exports.Prisma.MailCredentialsScalarFieldEnum = {
password: 'password',
host: 'host',
port: 'port',
secure: 'secure',
smtp_host: 'smtp_host',
smtp_port: 'smtp_port',
smtp_secure: 'smtp_secure',
display_name: 'display_name',
color: 'color',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
};