5748 Create contacts for emails sent and received by email aliases (#5855)

Closes #5748
- Create feature flag
- Add scope `https://www.googleapis.com/auth/profile.emails.read` when
connecting an account
- Get email aliases with google people API, store them in
connectedAccount and refresh them before each message-import
- Update the contact creation logic accordingly
- Refactor

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
bosiraphael
2024-07-01 14:21:34 +02:00
committed by GitHub
parent a15884ea0a
commit 8c33d91734
52 changed files with 1143 additions and 754 deletions

View File

@ -14,7 +14,7 @@ import { InjectWorkspaceRepository } from 'src/engine/twenty-orm/decorators/inje
import { WorkspaceRepository } from 'src/engine/twenty-orm/repository/workspace.repository';
import { SubscriptionStatus } from 'src/engine/core-modules/billing/entities/billing-subscription.entity';
import { isDefined } from 'src/utils/is-defined';
import { BillingService } from 'src/engine/core-modules/billing/billing.service';
import { BillingWorkspaceService } from 'src/engine/core-modules/billing/billing.workspace-service';
enum OnboardingStepValues {
SKIPPED = 'SKIPPED',
@ -33,7 +33,7 @@ type OnboardingKeyValueType = {
@Injectable()
export class OnboardingService {
constructor(
private readonly billingService: BillingService,
private readonly billingWorkspaceService: BillingWorkspaceService,
private readonly workspaceManagerService: WorkspaceManagerService,
private readonly userWorkspaceService: UserWorkspaceService,
private readonly keyValuePairService: KeyValuePairService<OnboardingKeyValueType>,
@ -45,7 +45,7 @@ export class OnboardingService {
private async isSubscriptionIncompleteOnboardingStatus(user: User) {
const isBillingEnabledForWorkspace =
await this.billingService.isBillingEnabledForWorkspace(
await this.billingWorkspaceService.isBillingEnabledForWorkspace(
user.defaultWorkspaceId,
);
@ -54,7 +54,7 @@ export class OnboardingService {
}
const currentBillingSubscription =
await this.billingService.getCurrentBillingSubscription({
await this.billingWorkspaceService.getCurrentBillingSubscription({
workspaceId: user.defaultWorkspaceId,
});