migrate angular 21 finalize
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {Document, HeadingLevel, ISectionOptions, Packer, Paragraph} from 'docx';
|
||||
import {ShowService} from './show.service';
|
||||
import {ShowTypePipe} from '../../../widget-modules/pipes/show-type-translater/show-type.pipe';
|
||||
@@ -26,13 +26,11 @@ export interface DownloadOptions {
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class DocxService {
|
||||
public constructor(
|
||||
private showService: ShowService,
|
||||
private showSongService: ShowSongService,
|
||||
private textRenderingService: TextRenderingService,
|
||||
private userService: UserService,
|
||||
private configService: ConfigService
|
||||
) {}
|
||||
private showService = inject(ShowService);
|
||||
private showSongService = inject(ShowSongService);
|
||||
private textRenderingService = inject(TextRenderingService);
|
||||
private userService = inject(UserService);
|
||||
private configService = inject(ConfigService);
|
||||
|
||||
public async create(showId: string, options: DownloadOptions = {}): Promise<void> {
|
||||
const data = await this.prepareData(showId);
|
||||
@@ -194,17 +192,17 @@ export class DocxService {
|
||||
if (!config) return null;
|
||||
|
||||
const showSongs = await this.showSongService.list(showId);
|
||||
const songsAsync = showSongs.map(showSong => {
|
||||
const sections = this.textRenderingService.parse(showSong.text, {
|
||||
baseKey: showSong.keyOriginal,
|
||||
targetKey: showSong.key,
|
||||
});
|
||||
return {
|
||||
showSong,
|
||||
sections,
|
||||
};
|
||||
});
|
||||
const songsLoaded = (await Promise.all(songsAsync))
|
||||
const songsLoaded = showSongs
|
||||
.map(showSong => {
|
||||
const sections = this.textRenderingService.parse(showSong.text, {
|
||||
baseKey: showSong.keyOriginal,
|
||||
targetKey: showSong.key,
|
||||
});
|
||||
return {
|
||||
showSong,
|
||||
sections,
|
||||
};
|
||||
})
|
||||
.filter(_ => !!_)
|
||||
.map(
|
||||
_ =>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {Observable} from 'rxjs';
|
||||
import {DbService} from '../../../services/db.service';
|
||||
import {Show} from './show';
|
||||
@@ -9,6 +9,8 @@ import {orderBy, QueryConstraint, Timestamp, where} from '@angular/fire/firestor
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ShowDataService {
|
||||
private dbService = inject(DbService);
|
||||
|
||||
private collection = 'shows';
|
||||
public list$: Observable<Show[]> = this.dbService.col$<Show>(this.collection).pipe(
|
||||
// server-side ordering cuts client work and keeps stable order across subscribers
|
||||
@@ -19,8 +21,6 @@ export class ShowDataService {
|
||||
})
|
||||
);
|
||||
|
||||
public constructor(private dbService: DbService) {}
|
||||
|
||||
public listRaw$ = () => this.dbService.col$<Show>(this.collection);
|
||||
|
||||
public listPublicSince$(lastMonths: number): Observable<Show[]> {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {DbService} from '../../../services/db.service';
|
||||
import {Observable} from 'rxjs';
|
||||
import {ShowSong} from './show-song';
|
||||
@@ -9,12 +9,12 @@ import {shareReplay} from 'rxjs/operators';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ShowSongDataService {
|
||||
private dbService = inject(DbService);
|
||||
|
||||
private collection = 'shows';
|
||||
private subCollection = 'songs';
|
||||
private listCache = new Map<string, Observable<ShowSong[]>>();
|
||||
|
||||
public constructor(private dbService: DbService) {}
|
||||
|
||||
public list$ = (showId: string, queryConstraints?: QueryConstraint[]): Observable<ShowSong[]> => {
|
||||
if (queryConstraints && queryConstraints.length > 0) {
|
||||
return this.dbService.col$(`${this.collection}/${showId}/${this.subCollection}`, queryConstraints);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {ShowSongDataService} from './show-song-data.service';
|
||||
import {firstValueFrom, Observable} from 'rxjs';
|
||||
import {ShowSong} from './show-song';
|
||||
@@ -10,12 +10,10 @@ import {ShowService} from './show.service';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ShowSongService {
|
||||
public constructor(
|
||||
private showSongDataService: ShowSongDataService,
|
||||
private songDataService: SongDataService,
|
||||
private userService: UserService,
|
||||
private showService: ShowService
|
||||
) {}
|
||||
private showSongDataService = inject(ShowSongDataService);
|
||||
private songDataService = inject(SongDataService);
|
||||
private userService = inject(UserService);
|
||||
private showService = inject(ShowService);
|
||||
|
||||
public async new$(showId: string, songId: string, addedLive = false): Promise<string | null> {
|
||||
const song = await firstValueFrom(this.songDataService.read$(songId));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {ShowDataService} from './show-data.service';
|
||||
import {Show} from './show';
|
||||
import {Observable} from 'rxjs';
|
||||
@@ -10,15 +10,17 @@ import {User} from '../../../services/user/user';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ShowService {
|
||||
private showDataService = inject(ShowDataService);
|
||||
private userService = inject(UserService);
|
||||
|
||||
public static SHOW_TYPE = ['service-worship', 'service-praise', 'home-group-big', 'home-group', 'prayer-group', 'teens-group', 'kids-group', 'misc-public', 'misc-private'];
|
||||
public static SHOW_TYPE_PUBLIC = ['service-worship', 'service-praise', 'home-group-big', 'teens-group', 'kids-group', 'misc-public'];
|
||||
public static SHOW_TYPE_PRIVATE = ['home-group', 'prayer-group', 'misc-private'];
|
||||
private user: User | null = null;
|
||||
|
||||
public constructor(
|
||||
private showDataService: ShowDataService,
|
||||
private userService: UserService
|
||||
) {
|
||||
public constructor() {
|
||||
const userService = this.userService;
|
||||
|
||||
userService.user$.subscribe(_ => (this.user = _));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user