refactor: inventory adjustments e2e test cases

This commit is contained in:
Ahmed Bouhuolia
2025-01-08 15:43:43 +02:00
parent 52362a43ab
commit ee284196eb
29 changed files with 257 additions and 68 deletions

View File

@@ -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;

View File

@@ -1,4 +1,3 @@
import { ITransactionsLockingPartialUnlocked } from '@/interfaces';
import {
SUBSCRIPTION_CANCELLED,
SUBSCRIPTION_PAYMENT_FAILED,

View File

@@ -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],
},
],