Moved from tslint to eslint as tslint was depreciated.
Added prettier and also prettied all the typescript files using prettier ESLint is using the AirBnB rules which are the most strict to lint the files.
This commit is contained in:
1 parent
40e79ff949
commit
1350870f9e
545 files changed
+8455
-7036
No files matched your search
@@ -1,87 +1,92 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Observable} from 'rxjs/internal/Observable';
|
||||
import {catchError} from 'rxjs/operators';
|
||||
import {HttpClient, HttpHeaders} from '@angular/common/http';
|
||||
import {ErrorLoggerService} from '../core/error-logger.service';
|
||||
import {Product} from '../core/product';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { ErrorLoggerService } from '../core/error-logger.service';
|
||||
import { Product } from '../core/product';
|
||||
|
||||
const httpOptions = {
|
||||
headers: new HttpHeaders({'Content-Type': 'application/json'})
|
||||
headers: new HttpHeaders({ 'Content-Type': 'application/json' }),
|
||||
};
|
||||
|
||||
const serviceName = 'SettingsService';
|
||||
|
||||
@Injectable({providedIn: 'root'})
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class SettingsService {
|
||||
|
||||
constructor(private http: HttpClient, private log: ErrorLoggerService) {
|
||||
}
|
||||
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
|
||||
|
||||
getLockInformation(): Observable<any> {
|
||||
const url = '/api/lock-information';
|
||||
return <Observable<any>>this.http.get<any>(url)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, `getLockInformation`))
|
||||
);
|
||||
return <Observable<any>>(
|
||||
this.http
|
||||
.get<any>(url)
|
||||
.pipe(catchError(this.log.handleError(serviceName, `getLockInformation`)))
|
||||
);
|
||||
}
|
||||
|
||||
setLockInformation(lockInformation: any): Observable<any> {
|
||||
const url = '/api/lock-information';
|
||||
return <Observable<any>>this.http.post<any>(url, lockInformation)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, `setLockInformation`))
|
||||
);
|
||||
return <Observable<any>>(
|
||||
this.http
|
||||
.post<any>(url, lockInformation)
|
||||
.pipe(catchError(this.log.handleError(serviceName, `setLockInformation`)))
|
||||
);
|
||||
}
|
||||
|
||||
deleteLockInformation(): Observable<any> {
|
||||
const url = '/api/lock-information';
|
||||
return <Observable<any>>this.http.delete<any>(url)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, `deleteLockInformation`))
|
||||
);
|
||||
return <Observable<any>>(
|
||||
this.http
|
||||
.delete<any>(url)
|
||||
.pipe(catchError(this.log.handleError(serviceName, `deleteLockInformation`)))
|
||||
);
|
||||
}
|
||||
|
||||
resetStock(resetDate: string, stockDate: string, product: Product, quantity: number): Observable<boolean> {
|
||||
resetStock(
|
||||
resetDate: string,
|
||||
stockDate: string,
|
||||
product: Product,
|
||||
quantity: number,
|
||||
): Observable<boolean> {
|
||||
const url = '/api/reset-stock';
|
||||
return <Observable<any>>this.http.post<any>(`${url}/${product.id}`, {
|
||||
stockDate: stockDate,
|
||||
resetDate: resetDate,
|
||||
quantity: quantity
|
||||
})
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, `resetStock`))
|
||||
);
|
||||
return <Observable<any>>this.http
|
||||
.post<any>(`${url}/${product.id}`, {
|
||||
stockDate: stockDate,
|
||||
resetDate: resetDate,
|
||||
quantity: quantity,
|
||||
})
|
||||
.pipe(catchError(this.log.handleError(serviceName, `resetStock`)));
|
||||
}
|
||||
|
||||
rebaseDatabase(date: string): Observable<boolean> {
|
||||
const url = '/api/rebase';
|
||||
return <Observable<any>>this.http.post<any>(`${url}/${date}`, {})
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, `rebaseDatabase`))
|
||||
);
|
||||
return <Observable<any>>(
|
||||
this.http
|
||||
.post<any>(`${url}/${date}`, {})
|
||||
.pipe(catchError(this.log.handleError(serviceName, `rebaseDatabase`)))
|
||||
);
|
||||
}
|
||||
|
||||
setMaintenance(enable: boolean): Observable<any> {
|
||||
const url = '/api/maintenance';
|
||||
return <Observable<any>>this.http.post<any>(url, {enabled: enable})
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, `setMaintenance`))
|
||||
);
|
||||
return <Observable<any>>this.http
|
||||
.post<any>(url, { enabled: enable })
|
||||
.pipe(catchError(this.log.handleError(serviceName, `setMaintenance`)));
|
||||
}
|
||||
|
||||
getMaintenance(): Observable<any> {
|
||||
const url = '/api/maintenance';
|
||||
return <Observable<any>>this.http.get<any>(url)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, `getMaintenance`))
|
||||
);
|
||||
return <Observable<any>>(
|
||||
this.http.get<any>(url).pipe(catchError(this.log.handleError(serviceName, `getMaintenance`)))
|
||||
);
|
||||
}
|
||||
|
||||
checkDatabaseIntegrity(): Observable<any> {
|
||||
const url = '/api/db-integrity';
|
||||
return <Observable<any>>this.http.post<any>(url, {})
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, `checkDatabaseIntegrity`))
|
||||
);
|
||||
return <Observable<any>>(
|
||||
this.http
|
||||
.post<any>(url, {})
|
||||
.pipe(catchError(this.log.handleError(serviceName, `checkDatabaseIntegrity`)))
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user