From 7284e968d89396ca5d138a0b4c6e43329df1ebf7 Mon Sep 17 00:00:00 2001 From: guillim Date: Fri, 10 Jan 2025 17:05:37 +0100 Subject: [PATCH] greptile --- .../commands/calendar-event-list-fetch.cron.command.ts | 4 +++- .../drivers/microsoft/messaging-microsoft-driver.module.ts | 6 +----- .../microsoft/providers/microsoft-client.provider.ts | 7 ++++--- .../services/microsoft-get-message-list.service.ts | 2 +- .../src/content/developers/self-hosting/setup.mdx | 5 ++--- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/commands/calendar-event-list-fetch.cron.command.ts b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/commands/calendar-event-list-fetch.cron.command.ts index 51f252cbca5a..80f3412795f8 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/commands/calendar-event-list-fetch.cron.command.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/commands/calendar-event-list-fetch.cron.command.ts @@ -5,6 +5,8 @@ import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queu import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { CalendarEventListFetchCronJob } from 'src/modules/calendar/calendar-event-import-manager/crons/jobs/calendar-event-list-fetch.cron.job'; +const CALENDAR_EVENTS_LIST_CRON_PATTERN = '*/5 * * * *'; + @Command({ name: 'cron:calendar:calendar-event-list-fetch', description: 'Starts a cron job to fetch the calendar event list', @@ -23,7 +25,7 @@ export class CalendarEventListFetchCronCommand extends CommandRunner { undefined, { repeat: { - pattern: '*/5 * * * *', + pattern: CALENDAR_EVENTS_LIST_CRON_PATTERN, }, }, ); diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/messaging-microsoft-driver.module.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/messaging-microsoft-driver.module.ts index 3d10a84c221f..e3afd094e0bc 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/messaging-microsoft-driver.module.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/messaging-microsoft-driver.module.ts @@ -1,4 +1,3 @@ -// import { HttpModule } from '@nestjs/axios'; import { Module } from '@nestjs/common'; import { EnvironmentModule } from 'src/engine/core-modules/environment/environment.module'; @@ -26,9 +25,6 @@ import { MicrosoftGetMessageListService } from './services/microsoft-get-message MicrosoftGetMessageListService, MicrosoftOAuth2ClientManagerService, ], - exports: [ - MicrosoftGetMessageListService, - // MicrosoftClientProvider - ], + exports: [MicrosoftGetMessageListService, MicrosoftClientProvider], }) export class MessagingMicrosoftDriverModule {} diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/providers/microsoft-client.provider.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/providers/microsoft-client.provider.ts index 8315fba28933..0dfc149b4957 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/providers/microsoft-client.provider.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/providers/microsoft-client.provider.ts @@ -14,7 +14,7 @@ export class MicrosoftClientProvider { public async getMicrosoftClient( connectedAccount: Pick< ConnectedAccountWorkspaceEntity, - 'provider' | 'refreshToken' | 'id' + 'refreshToken' | 'id' >, ): Promise { try { @@ -23,8 +23,9 @@ export class MicrosoftClientProvider { ); } catch (error) { throw new Error( - 'Failed to get Microsoft client: ' + - (error instanceof Error ? error.message : 'Unknown error'), + `Failed to get Microsoft client: ${ + error instanceof Error ? error.message : 'Unknown error' + }`, ); } } diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-get-message-list.service.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-get-message-list.service.ts index 61ac28f6a085..da526016d974 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-get-message-list.service.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-get-message-list.service.ts @@ -11,7 +11,7 @@ import { MicrosoftClientProvider } from 'src/modules/messaging/message-import-ma import { GetFullMessageListResponse } from 'src/modules/messaging/message-import-manager/services/messaging-get-message-list.service'; // Microsoft API limit is 1000 messages per request on this endpoint -const MESSAGING_MICROSOFT_USERS_MESSAGES_LIST_MAX_RESULT = 1; +const MESSAGING_MICROSOFT_USERS_MESSAGES_LIST_MAX_RESULT = 1000; @Injectable() export class MicrosoftGetMessageListService { diff --git a/packages/twenty-website/src/content/developers/self-hosting/setup.mdx b/packages/twenty-website/src/content/developers/self-hosting/setup.mdx index b66e54a1f416..b15ec739f2c0 100644 --- a/packages/twenty-website/src/content/developers/self-hosting/setup.mdx +++ b/packages/twenty-website/src/content/developers/self-hosting/setup.mdx @@ -88,9 +88,8 @@ On Microsoft Azure Console enable the following APIs in "Permissions": ### Authorized redirect URIs You need to add the following redirect URIs to your project: - -- `https:///auth/google/redirect` if you want to use Google SSO -- `https:///auth/google-apis/get-access-token` +- `https:///auth/microsoft/redirect` if you want to use Microsoft SSO +- `https:///auth/microsoft-apis/get-access-token` ### If your app is in test mode