Consolidated commit message to v22 signals

This commit is contained in:
tanshu committed 2026-08-25 14:45:09 +00:00
1 parent 6403d25d3e
commit df289b20b8
443 files changed
+16058 -17332

No files matched your search

+10 -19
View File
@@ -1,4 +1,4 @@
import { HttpClient } from '@angular/common/http';
import { HttpClient, httpResource } from '@angular/common/http';
import { inject, Injectable } from '@angular/core';
import { Observable } from 'rxjs/internal/Observable';
import { catchError } from 'rxjs/operators';
@@ -6,66 +6,57 @@ import { catchError } from 'rxjs/operators';
import { ErrorLoggerService } from '../core/error-logger.service';
import { LockInfo } from './lock-info';
const serviceName = 'SettingsService';
@Injectable({ providedIn: 'root' })
export class SettingsService {
private http = inject(HttpClient);
private log = inject(ErrorLoggerService);
getLockInformation(): Observable<[LockInfo]> {
getLockInformation() {
const url = '/api/lock-information';
return this.http
.get<[LockInfo]>(url)
.pipe(catchError(this.log.handleError(serviceName, 'getLockInformation'))) as Observable<[LockInfo]>;
return httpResource<[LockInfo]>(() => url);
}
setLockInformation(lockInformation: LockInfo): Observable<LockInfo[]> {
const url = '/api/lock-information';
return this.http
.post<LockInfo[]>(url, lockInformation)
.pipe(catchError(this.log.handleError(serviceName, 'setLockInformation'))) as Observable<LockInfo[]>;
.pipe(catchError(this.log.handleError('SettingsService', 'setLockInformation'))) as Observable<LockInfo[]>;
}
deleteLockInformation(id: string): Observable<LockInfo[]> {
const url = '/api/lock-information';
return this.http
.delete<LockInfo[]>(`${url}/${id}`)
.pipe(catchError(this.log.handleError(serviceName, 'deleteLockInformation'))) as Observable<LockInfo[]>;
.pipe(catchError(this.log.handleError('SettingsService', 'deleteLockInformation'))) as Observable<LockInfo[]>;
}
rebaseDatabase(date: string): Observable<Record<string, never>> {
const url = '/api/rebase';
return this.http
.post<Record<string, never>>(`${url}/${date}`, {})
.pipe(catchError(this.log.handleError(serviceName, 'rebaseDatabase'))) as Observable<Record<string, never>>;
.pipe(catchError(this.log.handleError('SettingsService', 'rebaseDatabase'))) as Observable<Record<string, never>>;
}
setMaintenance(enable: boolean): Observable<{ enabled: boolean; user: string }> {
const url = '/api/maintenance';
return this.http
.post<{ enabled: boolean; user: string }>(url, { enabled: enable })
.pipe(catchError(this.log.handleError(serviceName, 'setMaintenance'))) as Observable<{
.pipe(catchError(this.log.handleError('SettingsService', 'setMaintenance'))) as Observable<{
enabled: boolean;
user: string;
}>;
}
getMaintenance(): Observable<{ enabled: boolean; user: string }> {
getMaintenance() {
const url = '/api/maintenance';
return this.http
.get<{ enabled: boolean; user: string }>(url)
.pipe(catchError(this.log.handleError(serviceName, 'getMaintenance'))) as Observable<{
enabled: boolean;
user: string;
}>;
return httpResource<{ enabled: boolean; user: string }>(() => url);
}
checkDatabaseIntegrity(): Observable<{ attendanceCount: number }> {
const url = '/api/db-integrity';
return this.http
.post<{ attendanceCount: number }>(url, {})
.pipe(catchError(this.log.handleError(serviceName, 'checkDatabaseIntegrity'))) as Observable<{
.pipe(catchError(this.log.handleError('SettingsService', 'checkDatabaseIntegrity'))) as Observable<{
attendanceCount: number;
}>;
}