wip: email sync via imap with status tracking and auto cron
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -259,11 +259,16 @@ export const googleCallbackHandler = async (ctx: any) => {
|
||||
|
||||
const serverIntegration = await getServerIntegration('google');
|
||||
|
||||
// Merge with existing config to preserve fields like imapAppPassword
|
||||
const existingIntegration = await getUserIntegration(dbUser.id, 'google');
|
||||
const existingConfig = (existingIntegration?.config as Record<string, unknown>) ?? {};
|
||||
|
||||
await upsertUserIntegration({
|
||||
userId: dbUser.id,
|
||||
provider: 'google',
|
||||
serverIntegrationId: serverIntegration?.id,
|
||||
config: {
|
||||
...existingConfig,
|
||||
accessToken: tokens.access_token,
|
||||
refreshToken: tokens.refresh_token,
|
||||
expiresAt: Date.now() + tokens.expires_in * 1000,
|
||||
|
||||
Reference in New Issue
Block a user