From 4cfc70aa572f8e9be2d8a227af853a0a82fdb64a Mon Sep 17 00:00:00 2001 From: Janith Rathnayaka Date: Thu, 28 Nov 2024 15:58:56 +0530 Subject: [PATCH] add log for publisher --- apps/publisher/src/shared/shared.service.ts | 6 +++++- apps/publisher/src/wp-publisher/wp-publisher.service.ts | 4 +++- .../src/lib/meedan-check-client.service.ts | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/publisher/src/shared/shared.service.ts b/apps/publisher/src/shared/shared.service.ts index ef111bf9..783f8b00 100644 --- a/apps/publisher/src/shared/shared.service.ts +++ b/apps/publisher/src/shared/shared.service.ts @@ -1,7 +1,7 @@ import { Injectable, Scope } from "@nestjs/common"; import { MeedanCheckClientService } from "libs/meedan-check-client/src/lib/meedan-check-client.service"; import { Observable, Subject } from "rxjs"; -import { shareReplay, switchMap, take } from "rxjs/operators"; +import { shareReplay, switchMap, take, tap } from "rxjs/operators"; @Injectable() export class SharedService{ @@ -12,10 +12,13 @@ export class SharedService{ wpPost$: Observable = this._wpPost.asObservable().pipe(take(1), shareReplay(1)); report$: Observable = this.reportId$.pipe( + tap(id => console.log('report-reportId$', id)), switchMap(id => this.checkClient.getReport(id)), + tap(report => console.log('after-report$', report)), shareReplay(1) ) meedanReport$: Observable = this.reportId$.pipe( + tap(id => console.log('report-meedanReport$', id)), switchMap(id => this.checkClient.getMeedanReport(id)), shareReplay(1) ) @@ -26,6 +29,7 @@ export class SharedService{ constructor(private checkClient: MeedanCheckClientService){} updateReportId(id: string){ + console.log('updateReportId', id) this._reportId.next(id); } diff --git a/apps/publisher/src/wp-publisher/wp-publisher.service.ts b/apps/publisher/src/wp-publisher/wp-publisher.service.ts index 2eeb8d60..e5967846 100644 --- a/apps/publisher/src/wp-publisher/wp-publisher.service.ts +++ b/apps/publisher/src/wp-publisher/wp-publisher.service.ts @@ -29,7 +29,9 @@ import { DateTime } from 'luxon'; @Injectable() export class WpPublisherService { - private reportId$: Observable = this.shared.reportId$; + private reportId$: Observable = this.shared.reportId$.pipe( + tap(id => console.log('Shared reportId$', id)) // Log the emitted report ID +); private report$: Observable = this.shared.report$.pipe( tap((report) => console.log('Report: ', JSON.stringify(report))) ); diff --git a/libs/meedan-check-client/src/lib/meedan-check-client.service.ts b/libs/meedan-check-client/src/lib/meedan-check-client.service.ts index 87cf5552..8509f704 100644 --- a/libs/meedan-check-client/src/lib/meedan-check-client.service.ts +++ b/libs/meedan-check-client/src/lib/meedan-check-client.service.ts @@ -19,6 +19,7 @@ export class MeedanCheckClientService { ) {} getReport(id: string): Observable { + console.log(' getReport',id) const query: string = this.helper.buildGetReportQuery(id); const headers = this.config.headers; console.log('Getting report query: ', query); @@ -36,6 +37,7 @@ export class MeedanCheckClientService { } getMeedanReport(id: string): Observable { + console.log('Getting meedan reportid: ', id); const query: string = this.helper.buildGetMeedanReportQuery(id); const headers = this.config.headers; console.log('Getting meedan report query: ', query);