ui enhancements and song state

This commit is contained in:
2020-04-25 22:29:34 +02:00
committed by smuddy
parent 01d13ccea9
commit 4c5a8c972c
43 changed files with 297 additions and 141 deletions

View File

@@ -141,11 +141,11 @@ export class DocxService {
private async prepareData(showId: string): Promise<{ songs: ({ showSong: ShowSong, song: Song, sections: Section[] })[]; show: Show, user: User }> {
const show = await this.showService.read$(showId).pipe(first()).toPromise();
const user = await this.userService.getUserbyId$(show.owner).pipe(first()).toPromise();
const user = await this.userService.getUserbyId(show.owner);
const showSongs = await this.showSongService.list$(showId).pipe(first()).toPromise();
const showSongs = await this.showSongService.list(showId);
const songsAsync = await showSongs.map(async showSong => {
const song = await this.songService.read(showSong.songId).pipe(first()).toPromise();
const song = await this.songService.read(showSong.songId);
const sections = this.textRenderingService.parse(song.text);
return {
showSong,

View File

@@ -3,7 +3,7 @@ import {ShowSongDataService} from './show-song-data.service';
import {Observable} from 'rxjs';
import {ShowSong} from './show-song';
import {SongDataService} from '../../songs/services/song-data.service';
import {take} from 'rxjs/operators';
import {first, take} from 'rxjs/operators';
import {UserService} from '../../../services/user/user.service';
@Injectable({
@@ -33,6 +33,7 @@ export class ShowSongService {
}
public list$ = (showId: string): Observable<ShowSong[]> => this.showSongDataService.list$(showId, _ => _.orderBy('order'));
public list = (showId: string): Promise<ShowSong[]> => this.list$(showId).pipe(first()).toPromise();
public delete$ = (showId: string, songId: string): Promise<void> => this.showSongDataService.delete(showId, songId);
public update$ = async (showId: string, songId: string, data: Partial<ShowSong>): Promise<void> => await this.showSongDataService.update$(showId, songId, data);
}