add songs live on presentation

This commit is contained in:
2020-04-22 11:34:03 +02:00
committed by smuddy
parent db2d7d8d8c
commit 5c7e588c2a
17 changed files with 149 additions and 59 deletions

View File

@@ -1,7 +1,7 @@
import {Injectable} from '@angular/core';
import {ShowSongDataService} from './show-song-data.service';
import {Observable} from 'rxjs';
import {ShowSong} from './showSong';
import {ShowSong} from './show-song';
import {SongDataService} from '../../songs/services/song-data.service';
import {take} from 'rxjs/operators';
import {UserService} from '../../../services/user.service';
@@ -18,10 +18,17 @@ export class ShowSongService {
) {
}
public async new$(showId: string, songId: string, order: number): Promise<string> {
public async new$(showId: string, songId: string, order: number, addedLive = false): Promise<string> {
const song = await this.songDataService.read$(songId).pipe(take(1)).toPromise();
const user = await this.userService.user$.pipe(take(1)).toPromise();
const data: Partial<ShowSong> = {songId, order, key: song.key, keyOriginal: song.key, chordMode: user.chordMode};
const data: Partial<ShowSong> = {
songId,
order,
key: song.key,
keyOriginal: song.key,
chordMode: user.chordMode,
addedLive
};
return await this.showSongDataService.add(showId, data);
}