Skip to content

Commit

Permalink
add log for publisher
Browse files Browse the repository at this point in the history
  • Loading branch information
Janith Rathnayaka committed Nov 28, 2024
1 parent 2678b55 commit 4cfc70a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion apps/publisher/src/shared/shared.service.ts
Original file line number Diff line number Diff line change
@@ -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{
Expand All @@ -12,10 +12,13 @@ export class SharedService{
wpPost$: Observable<string> = this._wpPost.asObservable().pipe(take(1), shareReplay(1));

report$: Observable<any> = 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<any> = this.reportId$.pipe(
tap(id => console.log('report-meedanReport$', id)),
switchMap(id => this.checkClient.getMeedanReport(id)),
shareReplay(1)
)
Expand All @@ -26,6 +29,7 @@ export class SharedService{
constructor(private checkClient: MeedanCheckClientService){}

updateReportId(id: string){
console.log('updateReportId', id)
this._reportId.next(id);
}

Expand Down
4 changes: 3 additions & 1 deletion apps/publisher/src/wp-publisher/wp-publisher.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ import { DateTime } from 'luxon';

@Injectable()
export class WpPublisherService {
private reportId$: Observable<string> = this.shared.reportId$;
private reportId$: Observable<string> = this.shared.reportId$.pipe(
tap(id => console.log('Shared reportId$', id)) // Log the emitted report ID
);
private report$: Observable<any> = this.shared.report$.pipe(
tap((report) => console.log('Report: ', JSON.stringify(report)))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class MeedanCheckClientService {
) {}

getReport(id: string): Observable<any> {
console.log(' getReport',id)
const query: string = this.helper.buildGetReportQuery(id);
const headers = this.config.headers;
console.log('Getting report query: ', query);
Expand All @@ -36,6 +37,7 @@ export class MeedanCheckClientService {
}

getMeedanReport(id: string): Observable<any> {
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);
Expand Down

0 comments on commit 4cfc70a

Please sign in to comment.