create new title
This commit is contained in:
@@ -7,11 +7,14 @@ import {DbService} from '../../../services/db.service';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class SongDataService {
|
||||
private collection = 'songs';
|
||||
|
||||
constructor(private dbService: DbService) {
|
||||
}
|
||||
|
||||
public list$ = (): Observable<Song[]> => this.dbService.col$('songs');
|
||||
public read$ = (songId: string): Observable<Song | undefined> => this.dbService.doc$('songs/' + songId);
|
||||
public update$ = async (songId: string, data: any): Promise<void> => await this.dbService.doc('songs/' + songId).update(data);
|
||||
public list$ = (): Observable<Song[]> => this.dbService.col$(this.collection);
|
||||
public read$ = (songId: string): Observable<Song | undefined> => this.dbService.doc$(this.collection + '/' + songId);
|
||||
public update$ = async (songId: string, data: Partial<Song>): Promise<void> => await this.dbService.doc(this.collection + '/' + songId).update(data);
|
||||
public add = async (data: Partial<Song>): Promise<string> => (await this.dbService.col(this.collection).add(data)).id
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,10 @@ export class SongService {
|
||||
await this.songDataService.update$(songId, data);
|
||||
}
|
||||
|
||||
public async new(number: number, title: string): Promise<string> {
|
||||
return await this.songDataService.add({number, title, status: 'draft', legalType: 'open'})
|
||||
}
|
||||
|
||||
// https://www.csvjson.com/csv2json
|
||||
private async updateFromCLI(songs: Song[]) {
|
||||
const mapped = songs.map(_ => ({
|
||||
|
||||
Reference in New Issue
Block a user