5531 update gmail full sync to v2 (#5674)

Closes #5531

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
bosiraphael
2024-05-31 13:29:58 +02:00
committed by GitHub
parent fe941c64be
commit f166171a1c
39 changed files with 1062 additions and 581 deletions

View File

@ -2,7 +2,6 @@ import { Injectable } from '@nestjs/common';
import { OnEvent } from '@nestjs/event-emitter';
import { AnalyticsService } from 'src/engine/core-modules/analytics/analytics.service';
import { CreateAnalyticsInput } from 'src/engine/core-modules/analytics/dto/create-analytics.input';
import { ObjectRecordCreateEvent } from 'src/engine/integrations/event-emitter/types/object-record-create.event';
@Injectable()
@ -11,14 +10,13 @@ export class TelemetryListener {
@OnEvent('*.created')
async handleAllCreate(payload: ObjectRecordCreateEvent<any>) {
this.analyticsService.create(
await this.analyticsService.create(
{
type: 'track',
name: payload.name,
data: JSON.parse(`{
"eventName": "${payload.name}"
}`),
} as CreateAnalyticsInput,
data: {
eventName: payload.name,
},
},
payload.userId,
payload.workspaceId,
'', // voluntarely not retrieving this

View File

@ -12,7 +12,7 @@ import { User } from 'src/engine/core-modules/user/user.entity';
import { AnalyticsService } from './analytics.service';
import { Analytics } from './analytics.entity';
import { CreateAnalyticsInput } from './dto/create-analytics.input';
import { CreateAnalyticsInput } from './dtos/create-analytics.input';
@UseGuards(OptionalJwtAuthGuard)
@Resolver(() => Analytics)

View File

@ -4,7 +4,10 @@ import { HttpService } from '@nestjs/axios';
import { anonymize } from 'src/utils/anonymize';
import { EnvironmentService } from 'src/engine/integrations/environment/environment.service';
import { CreateAnalyticsInput } from './dto/create-analytics.input';
type CreateEventInput = {
type: string;
data: object;
};
@Injectable()
export class AnalyticsService {
@ -16,7 +19,7 @@ export class AnalyticsService {
) {}
async create(
createEventInput: CreateAnalyticsInput,
createEventInput: CreateEventInput,
userId: string | undefined,
workspaceId: string | undefined,
workspaceDisplayName: string | undefined,