Push event for user signup (#5837)

Need to setup Twenty as a CRM for Twenty the Twenty team
This commit is contained in:
Félix Malfait
2024-06-12 12:35:46 +02:00
committed by GitHub
parent 5fe2fc2778
commit bd22bfce2e
2 changed files with 24 additions and 0 deletions

View File

@ -24,4 +24,21 @@ export class TelemetryListener {
'',
);
}
@OnEvent('user.signup')
async handleUserSignup(payload: ObjectRecordCreateEvent<any>) {
await this.analyticsService.create(
{
type: 'track',
data: {
eventName: 'user.signup',
},
},
payload.userId,
payload.workspaceId,
'',
'',
'',
);
}
}

View File

@ -34,6 +34,13 @@ export class UserWorkspaceService extends TypeOrmQueryService<UserWorkspace> {
workspaceId,
});
const payload = new ObjectRecordCreateEvent<UserWorkspace>();
payload.workspaceId = workspaceId;
payload.userId = userId;
this.eventEmitter.emit('user.signup', payload);
return this.userWorkspaceRepository.save(userWorkspace);
}