courrier multi account restore compose
This commit is contained in:
parent
cf0f724323
commit
4bfb348082
@ -18,6 +18,7 @@ import {
|
||||
invalidateEmailContentCache
|
||||
} from '@/lib/redis';
|
||||
import { EmailCredentials, EmailMessage, EmailAddress, EmailAttachment } from '@/lib/types';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
// Types specific to this service
|
||||
export interface EmailListResult {
|
||||
@ -150,7 +151,7 @@ export async function getImapConnection(userId: string): Promise<ImapFlow> {
|
||||
* Get user's email credentials from database
|
||||
*/
|
||||
export async function getUserEmailCredentials(userId: string): Promise<EmailCredentials | null> {
|
||||
const credentials = await prisma.mailCredentials.findUnique({
|
||||
const credentials = await prisma.mailCredentials.findFirst({
|
||||
where: { userId },
|
||||
select: {
|
||||
id: true,
|
||||
@ -169,14 +170,14 @@ export async function getUserEmailCredentials(userId: string): Promise<EmailCred
|
||||
updatedAt: true
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (!credentials) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// Cache the credentials
|
||||
await cacheEmailCredentials(userId, credentials);
|
||||
|
||||
|
||||
return credentials;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user