mirror of
https://github.com/dadosfera/maestro.git
synced 2026-10-13 10:59:08 +00:00
30 lines
810 B
TypeScript
30 lines
810 B
TypeScript
import { Body, Controller, Inject, Param, Post, Req } from '@nestjs/common';
|
|
import { init } from 'mixpanel';
|
|
import { Authenticated } from 'src/decorators/authentication.decorator';
|
|
import { ApiInternalOnlyController } from 'src/decorators/swagger.decorator';
|
|
import { RequestUser, User } from 'src/decorators/user.decorator';
|
|
import { MixpanelService } from './mixpanel.service';
|
|
|
|
@ApiInternalOnlyController()
|
|
@Controller('trackEvent')
|
|
export class MixpanelController {
|
|
constructor(
|
|
private mixpanelService: MixpanelService
|
|
) {}
|
|
@Post(':id')
|
|
async trackEvent(
|
|
@Param('id') id,
|
|
@Body() body,
|
|
@User() user: RequestUser,
|
|
@Req() request
|
|
) {
|
|
delete body.info;
|
|
|
|
await this.mixpanelService.track(id, user, request, body)
|
|
|
|
return { id, body, user: user.username };
|
|
}
|
|
|
|
|
|
}
|