Removed the use of any and enabled the rule in eslint.
Now according to me the conversion is final. Testing is required.
This commit is contained in:
1 parent
715e35ef38
commit
2972203148
92 files changed
+610
-378
No files matched your search
@@ -0,0 +1,17 @@
|
||||
export class LockInfo {
|
||||
lockOlder: boolean;
|
||||
olderRolling?: boolean;
|
||||
olderDays?: number;
|
||||
olderDate?: string;
|
||||
|
||||
lockNewer: boolean;
|
||||
newerRolling?: boolean;
|
||||
newerDays?: number;
|
||||
newerDate?: string;
|
||||
|
||||
public constructor(init?: Partial<LockInfo>) {
|
||||
this.lockOlder = false;
|
||||
this.lockNewer = false;
|
||||
Object.assign(this, init);
|
||||
}
|
||||
}
|
||||
@@ -2,15 +2,16 @@ import { Injectable } from '@angular/core';
|
||||
import { Resolve } from '@angular/router';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
|
||||
import { LockInfo } from './lock-info';
|
||||
import { SettingsService } from './settings.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class LockInformationResolver implements Resolve<any> {
|
||||
export class LockInformationResolver implements Resolve<LockInfo> {
|
||||
constructor(private ser: SettingsService) {}
|
||||
|
||||
resolve(): Observable<any> {
|
||||
resolve(): Observable<LockInfo> {
|
||||
return this.ser.getLockInformation();
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,10 @@ import { SettingsService } from './settings.service';
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class MaintenanceResolver implements Resolve<any> {
|
||||
export class MaintenanceResolver implements Resolve<{ enabled: boolean; user: string }> {
|
||||
constructor(private ser: SettingsService) {}
|
||||
|
||||
resolve(): Observable<any> {
|
||||
resolve(): Observable<{ enabled: boolean; user: string }> {
|
||||
return this.ser.getMaintenance();
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import { ToasterService } from '../core/toaster.service';
|
||||
import { ProductService } from '../product/product.service';
|
||||
import { ConfirmDialogComponent } from '../shared/confirm-dialog/confirm-dialog.component';
|
||||
|
||||
import { LockInfo } from './lock-info';
|
||||
import { SettingsService } from './settings.service';
|
||||
|
||||
@Component({
|
||||
@@ -23,7 +24,7 @@ import { SettingsService } from './settings.service';
|
||||
})
|
||||
export class SettingsComponent implements OnInit {
|
||||
lockDatesForm: FormGroup;
|
||||
lockInformation: any;
|
||||
lockInformation: LockInfo;
|
||||
|
||||
rebaseDataForm: FormGroup;
|
||||
|
||||
@@ -31,7 +32,7 @@ export class SettingsComponent implements OnInit {
|
||||
product: Product = new Product();
|
||||
products: Observable<Product[]>;
|
||||
|
||||
maintenance: any;
|
||||
maintenance: { enabled: boolean; user: string };
|
||||
|
||||
version: string;
|
||||
|
||||
@@ -89,7 +90,10 @@ export class SettingsComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { maintenance: any; lockInformation: any };
|
||||
const data = value as {
|
||||
maintenance: { enabled: boolean; user: string };
|
||||
lockInformation: LockInfo;
|
||||
};
|
||||
|
||||
this.maintenance = data.maintenance;
|
||||
this.lockInformation = data.lockInformation;
|
||||
@@ -176,8 +180,7 @@ export class SettingsComponent implements OnInit {
|
||||
|
||||
rebaseData(rebaseDate: string) {
|
||||
this.ser.rebaseDatabase(rebaseDate).subscribe(
|
||||
(result) => {
|
||||
this.lockInformation = result;
|
||||
() => {
|
||||
this.toaster.show('Success', 'Data has been rebased!');
|
||||
},
|
||||
(error) => {
|
||||
@@ -230,8 +233,7 @@ export class SettingsComponent implements OnInit {
|
||||
|
||||
checkIntegrity() {
|
||||
this.ser.checkDatabaseIntegrity().subscribe(
|
||||
(result) => {
|
||||
this.lockInformation = result;
|
||||
() => {
|
||||
this.toaster.show('Success', 'Database checked, it is fine!');
|
||||
},
|
||||
(error) => {
|
||||
|
||||
@@ -6,35 +6,37 @@ import { catchError } from 'rxjs/operators';
|
||||
import { ErrorLoggerService } from '../core/error-logger.service';
|
||||
import { Product } from '../core/product';
|
||||
|
||||
import { LockInfo } from './lock-info';
|
||||
|
||||
const serviceName = 'SettingsService';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class SettingsService {
|
||||
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
|
||||
|
||||
getLockInformation(): Observable<any> {
|
||||
getLockInformation(): Observable<LockInfo> {
|
||||
const url = '/api/lock-information';
|
||||
return <Observable<any>>(
|
||||
return <Observable<LockInfo>>(
|
||||
this.http
|
||||
.get<any>(url)
|
||||
.get<LockInfo>(url)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'getLockInformation')))
|
||||
);
|
||||
}
|
||||
|
||||
setLockInformation(lockInformation: any): Observable<any> {
|
||||
setLockInformation(lockInformation: LockInfo): Observable<LockInfo> {
|
||||
const url = '/api/lock-information';
|
||||
return <Observable<any>>(
|
||||
return <Observable<LockInfo>>(
|
||||
this.http
|
||||
.post<any>(url, lockInformation)
|
||||
.post<LockInfo>(url, lockInformation)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'setLockInformation')))
|
||||
);
|
||||
}
|
||||
|
||||
deleteLockInformation(): Observable<any> {
|
||||
deleteLockInformation(): Observable<LockInfo> {
|
||||
const url = '/api/lock-information';
|
||||
return <Observable<any>>(
|
||||
return <Observable<LockInfo>>(
|
||||
this.http
|
||||
.delete<any>(url)
|
||||
.delete<LockInfo>(url)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'deleteLockInformation')))
|
||||
);
|
||||
}
|
||||
@@ -51,34 +53,36 @@ export class SettingsService {
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'resetStock')));
|
||||
}
|
||||
|
||||
rebaseDatabase(date: string): Observable<boolean> {
|
||||
rebaseDatabase(date: string): Observable<{}> {
|
||||
const url = '/api/rebase';
|
||||
return <Observable<any>>(
|
||||
return <Observable<{}>>(
|
||||
this.http
|
||||
.post<any>(`${url}/${date}`, {})
|
||||
.post<{}>(`${url}/${date}`, {})
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'rebaseDatabase')))
|
||||
);
|
||||
}
|
||||
|
||||
setMaintenance(enable: boolean): Observable<any> {
|
||||
setMaintenance(enable: boolean): Observable<{ enabled: boolean; user: string }> {
|
||||
const url = '/api/maintenance';
|
||||
return this.http
|
||||
.post<any>(url, { enabled: enable })
|
||||
return <Observable<{ enabled: boolean; user: string }>>this.http
|
||||
.post<{ enabled: boolean; user: string }>(url, { enabled: enable })
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'setMaintenance')));
|
||||
}
|
||||
|
||||
getMaintenance(): Observable<any> {
|
||||
getMaintenance(): Observable<{ enabled: boolean; user: string }> {
|
||||
const url = '/api/maintenance';
|
||||
return <Observable<any>>(
|
||||
this.http.get<any>(url).pipe(catchError(this.log.handleError(serviceName, 'getMaintenance')))
|
||||
return <Observable<{ enabled: boolean; user: string }>>(
|
||||
this.http
|
||||
.get<{ enabled: boolean; user: string }>(url)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'getMaintenance')))
|
||||
);
|
||||
}
|
||||
|
||||
checkDatabaseIntegrity(): Observable<any> {
|
||||
checkDatabaseIntegrity(): Observable<{ 'Duplicate Attendances Fixed': number }> {
|
||||
const url = '/api/db-integrity';
|
||||
return <Observable<any>>(
|
||||
return <Observable<{ 'Duplicate Attendances Fixed': number }>>(
|
||||
this.http
|
||||
.post<any>(url, {})
|
||||
.post<{ 'Duplicate Attendances Fixed': number }>(url, {})
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'checkDatabaseIntegrity')))
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user