mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
refactor: inventory adjustments e2e test cases
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { PostHog } from 'posthog-node';
|
||||
import { EventMessage } from 'posthog-node/src/types';
|
||||
// import { PostHog, EventMessage } from 'posthog-node';
|
||||
import { POSTHOG } from './postHog.module';
|
||||
import { TenancyContext } from '../Tenancy/TenancyContext.service';
|
||||
|
||||
interface EventMessage {
|
||||
distinctId
|
||||
}
|
||||
@Injectable()
|
||||
export class EventTrackerService {
|
||||
constructor(
|
||||
@Inject(POSTHOG) private readonly posthog: PostHog,
|
||||
@Inject(POSTHOG) private readonly posthog: any,
|
||||
private readonly tenancyContext: TenancyContext,
|
||||
) {}
|
||||
|
||||
@@ -15,7 +17,7 @@ export class EventTrackerService {
|
||||
* Track tenant an event.
|
||||
* @param event - The event to track.
|
||||
*/
|
||||
public async trackEvent(event: Omit<EventMessage, 'distinctId'>) {
|
||||
public async trackEvent(event: any) {
|
||||
// Cannot continue if the Posthog not configured.
|
||||
if (!this.posthog) return;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { ITransactionsLockingPartialUnlocked } from '@/interfaces';
|
||||
import {
|
||||
SUBSCRIPTION_CANCELLED,
|
||||
SUBSCRIPTION_PAYMENT_FAILED,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { PostHog } from 'posthog-node';
|
||||
// import { PostHog } from 'posthog-node';
|
||||
import { EventTrackerService } from './EventTracker.service';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
|
||||
@@ -10,10 +10,12 @@ export const POSTHOG = 'PostHog';
|
||||
EventTrackerService,
|
||||
{
|
||||
provide: POSTHOG,
|
||||
useFactory: (configService: ConfigService) =>
|
||||
new PostHog(configService.get('posthog.apiKey'), {
|
||||
host: configService.get('posthog.host'),
|
||||
}),
|
||||
useFactory: (configService: ConfigService) => {
|
||||
|
||||
},
|
||||
// new PostHog(configService.get('posthog.apiKey'), {
|
||||
// host: configService.get('posthog.host'),
|
||||
// }),
|
||||
inject: [ConfigService],
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user