show component

This commit is contained in:
2020-03-08 09:45:05 +01:00
committed by smuddy
parent d68cd590ad
commit bb0676a428
53 changed files with 344 additions and 185 deletions

View File

@@ -0,0 +1,19 @@
import {Injectable} from '@angular/core';
import {Observable} from 'rxjs';
import {DbService} from '../../../services/db.service';
import {Show} from './show';
@Injectable({
providedIn: 'root'
})
export class ShowDataService {
private collection = 'shows';
constructor(private dbService: DbService) {
}
public list$ = (): Observable<Show[]> => this.dbService.col$(this.collection);
public read$ = (showId: string): Observable<Show | undefined> => this.dbService.doc$(`${this.collection}/${showId}`);
public update = async (showId: string, data: Partial<Show>): Promise<void> => await this.dbService.doc(`${this.collection}/${showId}`).update(data);
public add = async (data: Partial<Show>): Promise<string> => (await this.dbService.col(this.collection).add(data)).id
}