This commit is contained in:
ztimson
2019-08-08 08:36:22 -04:00
parent 8a9d759c41
commit 39c87666d8
3 changed files with 1 additions and 9 deletions

View File

@ -1,24 +0,0 @@
import {Injectable} from "@angular/core";
import {AngularFirestore, AngularFirestoreCollection, DocumentSnapshot} from "@angular/fire/firestore";
import {map} from "rxjs/operators";
@Injectable({
providedIn: 'root'
})
export class SyncService {
private collection: AngularFirestoreCollection;
constructor(private db: AngularFirestore) {
this.collection = this.db.collection('Maps');
}
async exists(mapCode: string) {
return (await this.collection.doc(mapCode).ref.get()).exists;
}
load(mapCode: string) {
return this.collection.doc(mapCode).snapshotChanges().pipe(map((snap: any) => {
return Object.assign({}, snap.data, {delete: snap.ref.delete, set: snap.ref.set, update: snap.ref.update});
}))
}
}