Blacked and isorted the python files

Prettied and eslinted the typescript/html files
This commit is contained in:
2020-10-11 10:56:29 +05:30
parent b31db593c2
commit d677cfb1ea
505 changed files with 7559 additions and 5649 deletions
+34 -30
View File
@@ -1,64 +1,68 @@
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { ErrorLoggerService } from '../core/error-logger.service';
import { catchError } from 'rxjs/operators';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/internal/Observable';
import { catchError } from 'rxjs/operators';
import { ErrorLoggerService } from '../core/error-logger.service';
import { Printer } from '../core/printer';
const httpOptions = {
headers: new HttpHeaders({'Content-Type': 'application/json'})
headers: new HttpHeaders({ 'Content-Type': 'application/json' }),
};
const url = '/api/printers';
const serviceName = 'PrinterService';
@Injectable({
providedIn: 'root'
providedIn: 'root',
})
export class PrinterService {
constructor(private http: HttpClient, private log: ErrorLoggerService) {
}
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
get(id: string): Observable<Printer> {
const getUrl: string = (id === null) ? url : `${url}/${id}`;
return <Observable<Printer>>this.http.get<Printer>(getUrl)
.pipe(
catchError(this.log.handleError(serviceName, `get id=${id}`))
);
const getUrl: string = id === null ? url : `${url}/${id}`;
return <Observable<Printer>>(
this.http
.get<Printer>(getUrl)
.pipe(catchError(this.log.handleError(serviceName, `get id=${id}`)))
);
}
list(): Observable<Printer[]> {
return <Observable<Printer[]>>this.http.get<Printer[]>(`${url}/list`)
.pipe(
catchError(this.log.handleError(serviceName, 'list'))
);
return <Observable<Printer[]>>(
this.http
.get<Printer[]>(`${url}/list`)
.pipe(catchError(this.log.handleError(serviceName, 'list')))
);
}
save(printer: Printer): Observable<Printer> {
return <Observable<Printer>>this.http.post<Printer>(url, printer, httpOptions)
.pipe(
catchError(this.log.handleError(serviceName, 'save'))
);
return <Observable<Printer>>(
this.http
.post<Printer>(url, printer, httpOptions)
.pipe(catchError(this.log.handleError(serviceName, 'save')))
);
}
update(printer: Printer): Observable<Printer> {
return <Observable<Printer>>this.http.put<Printer>(`${url}/${printer.id}`, printer, httpOptions)
.pipe(
catchError(this.log.handleError(serviceName, 'update'))
);
return <Observable<Printer>>(
this.http
.put<Printer>(`${url}/${printer.id}`, printer, httpOptions)
.pipe(catchError(this.log.handleError(serviceName, 'update')))
);
}
saveOrUpdate(printer: Printer): Observable<Printer> {
if (!printer.id) {
return this.save(printer);
} else {
return this.update(printer);
}
return this.update(printer);
}
delete(id: string): Observable<Printer> {
return <Observable<Printer>>this.http.delete<Printer>(`${url}/${id}`, httpOptions)
.pipe(
catchError(this.log.handleError(serviceName, 'delete'))
);
return <Observable<Printer>>(
this.http
.delete<Printer>(`${url}/${id}`, httpOptions)
.pipe(catchError(this.log.handleError(serviceName, 'delete')))
);
}
}