update tslint -> eslint
This commit is contained in:
@@ -1,19 +1,18 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {AngularFirestore, AngularFirestoreCollection, AngularFirestoreDocument} from '@angular/fire/firestore';
|
||||
import {Observable} from 'rxjs';
|
||||
import {QueryFn} from '@angular/fire/firestore/interfaces';
|
||||
|
||||
type CollectionPredicate<T> = string | AngularFirestoreCollection<T>;
|
||||
type DocumentPredicate<T> = string | AngularFirestoreDocument<T>;
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class DbService {
|
||||
public constructor(private afs: AngularFirestore) {}
|
||||
|
||||
constructor(private afs: AngularFirestore) {
|
||||
}
|
||||
|
||||
public col<T>(ref: CollectionPredicate<T>, queryFn?): AngularFirestoreCollection<T> {
|
||||
public col<T>(ref: CollectionPredicate<T>, queryFn?: QueryFn): AngularFirestoreCollection<T> {
|
||||
return typeof ref === 'string' ? this.afs.collection<T>(ref, queryFn) : ref;
|
||||
}
|
||||
|
||||
@@ -23,10 +22,9 @@ export class DbService {
|
||||
|
||||
public doc$<T>(ref: DocumentPredicate<T>): Observable<T> {
|
||||
return this.doc(ref).valueChanges({idField: 'id'});
|
||||
|
||||
}
|
||||
|
||||
public col$<T>(ref: CollectionPredicate<T>, queryFn?): Observable<T[]> {
|
||||
public col$<T>(ref: CollectionPredicate<T>, queryFn?: QueryFn): Observable<T[]> {
|
||||
return this.col(ref, queryFn).valueChanges({idField: 'id'});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user