import { Injectable } from '@angular/core' ; import { AngularFirestore } from '@angular/fire/firestore' ; import { Observable } from 'rxjs' ; import { switchMap } from 'rxjs/operators' ; import { IProject , PingModel } from '@shared/models/index.model' ; import { ActivityService } from './activity.service' ; /**
 * Ping service
 */ @ Injectable ( { providedIn : 'root' , } ) export class PingService { param afs param activityService constructor ( private afs , private activityService ) { } param projectUid param monitorUid public findAllByMonitor ( projectUid , monitorUid ) { return this . activityService . start ( ) . pipe ( switchMap ( ( ) => this . afs . collection < IProject > ( 'projects' ) . doc < IProject > ( projectUid ) . collection < PingModel > ( 'pings' , ( ref ) => ref . where ( 'monitorUid' , '==' , monitorUid ) . orderBy ( 'createdOn' , 'desc' ) ) . valueChanges ( ) ) ) ; } }