migrate angular 21 finalize

This commit is contained in:
2026-03-09 22:56:31 +01:00
parent 26c99a0dae
commit bb08e46b0c
63 changed files with 738 additions and 783 deletions

View File

@@ -1,4 +1,4 @@
import {Injectable} from '@angular/core';
import {Injectable, inject} from '@angular/core';
import {Observable} from 'rxjs';
import {shareReplay} from 'rxjs/operators';
import {DbService} from 'src/app/services/db.service';
@@ -8,6 +8,8 @@ import {GuestShow} from './guest-show';
providedIn: 'root',
})
export class GuestShowDataService {
private dbService = inject(DbService);
private collection = 'guest';
public list$: Observable<GuestShow[]> = this.dbService.col$<GuestShow>(this.collection).pipe(
shareReplay({
@@ -16,8 +18,6 @@ export class GuestShowDataService {
})
);
public constructor(private dbService: DbService) {}
public read$: (id: string) => Observable<GuestShow | null> = (id: string): Observable<GuestShow | null> => this.dbService.doc$(`${this.collection}/${id}`);
public update$: (id: string, data: Partial<GuestShow>) => Promise<void> = async (id: string, data: Partial<GuestShow>): Promise<void> =>
await this.dbService.doc(this.collection + '/' + id).update(data);

View File

@@ -1,4 +1,4 @@
import {Injectable} from '@angular/core';
import {Injectable, inject} from '@angular/core';
import {Show} from '../shows/services/show';
import {Song} from '../songs/services/song';
import {GuestShowDataService} from './guest-show-data.service';
@@ -8,10 +8,8 @@ import {ShowService} from '../shows/services/show.service';
providedIn: 'root',
})
export class GuestShowService {
public constructor(
private showService: ShowService,
private guestShowDataService: GuestShowDataService
) {}
private showService = inject(ShowService);
private guestShowDataService = inject(GuestShowDataService);
public async share(show: Show, songs: Song[]): Promise<string> {
const data = {

View File

@@ -1,4 +1,4 @@
import {Component, CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
import {Component, CUSTOM_ELEMENTS_SCHEMA, inject} from '@angular/core';
import {GuestShowDataService} from './guest-show-data.service';
import {ActivatedRoute} from '@angular/router';
import {map, switchMap} from 'rxjs/operators';
@@ -16,17 +16,15 @@ import {ShowTypePipe} from '../../widget-modules/pipes/show-type-translater/show
imports: [SongTextComponent, AsyncPipe, DatePipe, ShowTypePipe],
})
export class GuestComponent {
private currentRoute = inject(ActivatedRoute);
private service = inject(GuestShowDataService);
private configService = inject(ConfigService);
public show$ = this.currentRoute.params.pipe(
map(param => param.id as string),
switchMap(id => this.service.read$(id))
);
public config$ = this.configService.get$();
public constructor(
private currentRoute: ActivatedRoute,
private service: GuestShowDataService,
private configService: ConfigService
) {}
public trackBy = (index: number, show: Song) => show.id;
}