diff --git a/src/app.module.ts b/src/app.module.ts index 8101f433..bceadd8e 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -6,6 +6,7 @@ import { AuthModule } from './auth/auth.module'; import { CoursePartnerModule } from './course-partner/course-partner.module'; import { CourseUserModule } from './course-user/course-user.module'; import { CourseModule } from './course/course.module'; +import { EventLoggerModule } from './event-logger/event-logger.module'; import { FeatureModule } from './feature/feature.module'; import { LoggerModule } from './logger/logger.module'; import { PartnerAccessModule } from './partner-access/partner-access.module'; @@ -37,6 +38,7 @@ import { WebhooksModule } from './webhooks/webhooks.module'; SubscriptionUserModule, FeatureModule, PartnerFeatureModule, + EventLoggerModule, ], }) export class AppModule {} diff --git a/src/event-logger/event-logger.controller.ts b/src/event-logger/event-logger.controller.ts index b7043eb6..89d9c0ab 100644 --- a/src/event-logger/event-logger.controller.ts +++ b/src/event-logger/event-logger.controller.ts @@ -17,7 +17,7 @@ export class EventLoggerController { }) @ApiBearerAuth('access-token') @UseGuards(FirebaseAuthGuard) - async complete(@Req() req: Request, @Body() event: EVENT_NAME) { + async createEventLog(@Req() req: Request, @Body() { event }: { event: EVENT_NAME }) { const now = new Date(); return await this.eventLoggerService.createEventLog({ userId: req['userEntity'].id, diff --git a/src/event-logger/event-logger.module.ts b/src/event-logger/event-logger.module.ts index ae093b77..f0ff9a34 100644 --- a/src/event-logger/event-logger.module.ts +++ b/src/event-logger/event-logger.module.ts @@ -1,10 +1,44 @@ import { Module } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; +import { SlackMessageClient } from 'src/api/slack/slack-api'; +import { ZapierWebhookClient } from 'src/api/zapier/zapier-webhook-client'; import { EventLogEntity } from 'src/entities/event-log.entity'; +import { PartnerAccessEntity } from 'src/entities/partner-access.entity'; +import { PartnerEntity } from 'src/entities/partner.entity'; +import { SubscriptionUserEntity } from 'src/entities/subscription-user.entity'; +import { SubscriptionEntity } from 'src/entities/subscription.entity'; +import { TherapySessionEntity } from 'src/entities/therapy-session.entity'; +import { UserEntity } from 'src/entities/user.entity'; +import { PartnerAccessService } from 'src/partner-access/partner-access.service'; +import { SubscriptionUserService } from 'src/subscription-user/subscription-user.service'; +import { SubscriptionService } from 'src/subscription/subscription.service'; +import { TherapySessionService } from 'src/therapy-session/therapy-session.service'; +import { UserService } from 'src/user/user.service'; +import { EventLoggerController } from './event-logger.controller'; import { EventLoggerService } from './event-logger.service'; @Module({ - imports: [TypeOrmModule.forFeature([EventLogEntity])], - providers: [EventLoggerService], + imports: [ + TypeOrmModule.forFeature([ + EventLogEntity, + UserEntity, + PartnerAccessEntity, + PartnerEntity, + SubscriptionUserEntity, + TherapySessionEntity, + SubscriptionEntity, + ]), + ], + controllers: [EventLoggerController], + providers: [ + EventLoggerService, + UserService, + SubscriptionUserService, + TherapySessionService, + PartnerAccessService, + SubscriptionService, + ZapierWebhookClient, + SlackMessageClient, + ], }) -export class SessionModule {} +export class EventLoggerModule {}