clean up and lint files
This commit is contained in:
@@ -7,10 +7,8 @@ import {Config} from './config';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ConfigService {
|
||||
public constructor(private db: DbService) {
|
||||
}
|
||||
public constructor(private db: DbService) {}
|
||||
|
||||
public get$ = (): Observable<Config | null> => this.db.doc$<Config>('global/config');
|
||||
public get = (): Promise<Config | null> => firstValueFrom(this.get$());
|
||||
|
||||
}
|
||||
|
||||
@@ -11,8 +11,7 @@ type DocumentPredicate<T> = string | AngularFirestoreDocument<T>;
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class DbService {
|
||||
public constructor(private afs: AngularFirestore) {
|
||||
}
|
||||
public constructor(private afs: AngularFirestore) {}
|
||||
|
||||
public col<T>(ref: CollectionPredicate<T>, queryFn?: QueryFn): AngularFirestoreCollection<T> {
|
||||
return typeof ref === 'string' ? this.afs.collection<T>(ref, queryFn) : ref;
|
||||
|
||||
@@ -4,7 +4,7 @@ import {filterSong} from './filter.helper';
|
||||
describe('Filter Helper', () => {
|
||||
const song: Song = {
|
||||
title: 'Song Title',
|
||||
text: 'This is a songtext, aa?bb!cc,dd.ee\'ff',
|
||||
text: "This is a songtext, aa?bb!cc,dd.ee'ff",
|
||||
legalOwner: '',
|
||||
label: '',
|
||||
id: '',
|
||||
|
||||
@@ -22,7 +22,7 @@ export function dynamicSort(property: string) {
|
||||
sortOrder = -1;
|
||||
property = property.substr(1);
|
||||
}
|
||||
return function(a: unknown, b: unknown) {
|
||||
return function (a: unknown, b: unknown) {
|
||||
/* next line works with strings and numbers,
|
||||
* and you may want to customize it to your needs
|
||||
*/
|
||||
|
||||
@@ -7,8 +7,7 @@ import {Observable} from 'rxjs';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class GlobalSettingsService {
|
||||
public constructor(private db: DbService) {
|
||||
}
|
||||
public constructor(private db: DbService) {}
|
||||
|
||||
public get get$(): Observable<GlobalSettings | null> {
|
||||
return this.db.doc$<GlobalSettings>('global/static');
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
import {Directive, ElementRef, Input, OnInit, TemplateRef, ViewContainerRef} from '@angular/core';
|
||||
import {UserService} from './user.service';
|
||||
|
||||
@Directive({ selector: '[appOwner]', })
|
||||
@Directive({selector: '[appOwner]'})
|
||||
export class OwnerDirective implements OnInit {
|
||||
private currentUserId: string | null = null;
|
||||
private iAppOwner: string | null = null;
|
||||
|
||||
public constructor(private element: ElementRef, private templateRef: TemplateRef<unknown>, private viewContainer: ViewContainerRef, private userService: UserService) {
|
||||
}
|
||||
public constructor(
|
||||
private element: ElementRef,
|
||||
private templateRef: TemplateRef<unknown>,
|
||||
private viewContainer: ViewContainerRef,
|
||||
private userService: UserService
|
||||
) {}
|
||||
|
||||
@Input()
|
||||
public set appOwner(value: string) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import {UserService} from './user.service';
|
||||
import {User} from './user';
|
||||
import {combineLatest} from 'rxjs';
|
||||
|
||||
@Directive({ selector: '[appRole]', })
|
||||
@Directive({selector: '[appRole]'})
|
||||
export class RoleDirective implements OnInit {
|
||||
@Input() public appRole: roles[] = [];
|
||||
private currentUser: User | null = null;
|
||||
@@ -16,9 +16,8 @@ export class RoleDirective implements OnInit {
|
||||
private templateRef: TemplateRef<unknown>,
|
||||
private viewContainer: ViewContainerRef,
|
||||
private userService: UserService,
|
||||
private changeDetection: ChangeDetectorRef,
|
||||
) {
|
||||
}
|
||||
private changeDetection: ChangeDetectorRef
|
||||
) {}
|
||||
|
||||
public ngOnInit(): void {
|
||||
combineLatest([this.userService.user$, this.userService.loggedIn$()]).subscribe(_ => {
|
||||
|
||||
@@ -6,13 +6,11 @@ describe('UserNameComponent', () => {
|
||||
let component: UserNameComponent;
|
||||
let fixture: ComponentFixture<UserNameComponent>;
|
||||
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
void TestBed.configureTestingModule({
|
||||
imports: [UserNameComponent],
|
||||
}).compileComponents();
|
||||
}),
|
||||
);
|
||||
beforeEach(waitForAsync(() => {
|
||||
void TestBed.configureTestingModule({
|
||||
imports: [UserNameComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(UserNameComponent);
|
||||
|
||||
@@ -2,19 +2,18 @@ import {Component, Input} from '@angular/core';
|
||||
import {UserService} from '../user.service';
|
||||
import {map} from 'rxjs/operators';
|
||||
import {Observable} from 'rxjs';
|
||||
import { AsyncPipe } from '@angular/common';
|
||||
import {AsyncPipe} from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'app-user-name',
|
||||
templateUrl: './user-name.component.html',
|
||||
styleUrls: ['./user-name.component.less'],
|
||||
imports: [AsyncPipe],
|
||||
selector: 'app-user-name',
|
||||
templateUrl: './user-name.component.html',
|
||||
styleUrls: ['./user-name.component.less'],
|
||||
imports: [AsyncPipe],
|
||||
})
|
||||
export class UserNameComponent {
|
||||
public name$: Observable<string | null> | null = null;
|
||||
|
||||
public constructor(private userService: UserService) {
|
||||
}
|
||||
public constructor(private userService: UserService) {}
|
||||
|
||||
@Input()
|
||||
public set userId(id: string) {
|
||||
|
||||
@@ -22,14 +22,14 @@ export class UserService {
|
||||
private db: DbService,
|
||||
private router: Router,
|
||||
private showDataService: ShowDataService,
|
||||
private showSongDataService: ShowSongDataService,
|
||||
private showSongDataService: ShowSongDataService
|
||||
) {
|
||||
this.afAuth.authState
|
||||
.pipe(
|
||||
filter(auth => !!auth),
|
||||
map(auth => auth?.uid ?? ''),
|
||||
tap(uid => this.iUserId$.next(uid)),
|
||||
switchMap(uid => this.readUser$(uid)),
|
||||
switchMap(uid => this.readUser$(uid))
|
||||
)
|
||||
.subscribe(_ => this.iUser$.next(_));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user