Chore: ng lint using the recommended @angular-eslint style

This commit is contained in:
2020-12-08 18:50:46 +05:30
parent 130d9197e5
commit d65379a068
50 changed files with 524 additions and 636 deletions

View File

@ -20,11 +20,9 @@ export class VoucherService {
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
get(id: string): Observable<Bill> {
return <Observable<Bill>>(
this.http
.get<Bill>(`${url}/from-id/${id}`)
.pipe(catchError(this.log.handleError(serviceName, `get id=${id}`)))
);
return this.http
.get<Bill>(`${url}/from-id/${id}`)
.pipe(catchError(this.log.handleError(serviceName, `get id=${id}`))) as Observable<Bill>;
}
getFromTable(
@ -40,7 +38,7 @@ export class VoucherService {
params = params.set('g', guestId);
}
return <Observable<Bill>>this.http
return this.http
.get<Bill>(`${url}/from-table/${tableId}`, { params })
.pipe(
catchError(
@ -49,7 +47,7 @@ export class VoucherService {
`getFromTable tableId=${tableId} voucherId=${voucherId} guestId=${guestId}`,
),
),
);
) as Observable<Bill>;
}
save(
@ -64,11 +62,9 @@ export class VoucherService {
if (guestBookId !== null) {
options.params = options.params.set('g', guestBookId);
}
return <Observable<boolean>>(
this.http
.post<boolean>(`${url}/save`, voucher, options)
.pipe(catchError(this.log.handleError(serviceName, 'save')))
);
return this.http
.post<boolean>(`${url}/save`, voucher, options)
.pipe(catchError(this.log.handleError(serviceName, 'save'))) as Observable<boolean>;
}
update(
@ -83,11 +79,9 @@ export class VoucherService {
if (guestBookId !== null) {
options.params = options.params.set('g', guestBookId);
}
return <Observable<boolean>>(
this.http
.put<boolean>(`${url}/update/${voucher.id}`, voucher, options)
.pipe(catchError(this.log.handleError(serviceName, 'update')))
);
return this.http
.put<boolean>(`${url}/update/${voucher.id}`, voucher, options)
.pipe(catchError(this.log.handleError(serviceName, 'update'))) as Observable<boolean>;
}
change(
@ -100,11 +94,9 @@ export class VoucherService {
if (guestBookId !== null) {
options.params = options.params.set('g', guestBookId);
}
return <Observable<boolean>>(
this.http
.put<boolean>(`${url}/change/${voucher.id}`, voucher, options)
.pipe(catchError(this.log.handleError(serviceName, 'change')))
);
return this.http
.put<boolean>(`${url}/change/${voucher.id}`, voucher, options)
.pipe(catchError(this.log.handleError(serviceName, 'change'))) as Observable<boolean>;
}
saveOrUpdate(
@ -129,67 +121,67 @@ export class VoucherService {
updateTable: boolean,
): Observable<boolean> {
const options = { params: new HttpParams().set('u', updateTable.toString()) };
return <Observable<boolean>>(
this.http
.post<boolean>(`${url}/receive-payment/${id}`, { name, amounts }, options)
.pipe(catchError(this.log.handleError(serviceName, 'receivePayment')))
);
return this.http
.post<boolean>(`${url}/receive-payment/${id}`, { name, amounts }, options)
.pipe(catchError(this.log.handleError(serviceName, 'receivePayment'))) as Observable<boolean>;
}
voidBill(id: string, reason: string, updateTable: boolean): Observable<boolean> {
const options = {
params: new HttpParams().set('reason', reason).set('u', updateTable.toString()),
};
return <Observable<boolean>>(
this.http
.post<boolean>(`${url}/void-bill/${id}`, {}, options)
.pipe(catchError(this.log.handleError(serviceName, 'voidBill')))
);
return this.http
.post<boolean>(`${url}/void-bill/${id}`, {}, options)
.pipe(catchError(this.log.handleError(serviceName, 'voidBill'))) as Observable<boolean>;
}
moveTable(id: string, table: Table): Observable<boolean> {
return <Observable<boolean>>this.http
return this.http
.post<boolean>(`${urlMoveTable}/move`, {
voucherId: id,
tableId: table.id,
})
.pipe(catchError(this.log.handleError(serviceName, 'moveTable')));
.pipe(catchError(this.log.handleError(serviceName, 'moveTable'))) as Observable<boolean>;
}
mergeTable(id: string, table: Table): Observable<boolean> {
return <Observable<boolean>>this.http
return this.http
.post<boolean>(`${urlMoveTable}/merge`, {
voucherId: id,
tableId: table.id,
newVoucherId: table.voucherId,
})
.pipe(catchError(this.log.handleError(serviceName, 'mergeTable')));
.pipe(catchError(this.log.handleError(serviceName, 'mergeTable'))) as Observable<boolean>;
}
moveKotToNewTable(id: string, kotId: string, table: Table): Observable<boolean> {
return <Observable<boolean>>this.http
return this.http
.post<boolean>(`${urlMoveKot}/move`, {
voucherId: id,
kotId,
tableId: table.id,
})
.pipe(catchError(this.log.handleError(serviceName, 'moveKotToNewTable')));
.pipe(
catchError(this.log.handleError(serviceName, 'moveKotToNewTable')),
) as Observable<boolean>;
}
mergeKotWithOldBill(id: string, kotId: string, table: Table): Observable<boolean> {
return <Observable<boolean>>this.http
return this.http
.post<boolean>(`${urlMoveKot}/merge`, {
voucherId: id,
kotId,
tableId: table.id,
newVoucherId: table.voucherId,
})
.pipe(catchError(this.log.handleError(serviceName, 'mergeKotWithOldBill')));
.pipe(
catchError(this.log.handleError(serviceName, 'mergeKotWithOldBill')),
) as Observable<boolean>;
}
splitBill(id: string, inventoriesToMove: string[], table: Table) {
const options = { params: new HttpParams().set('u', 'true') };
return <Observable<boolean>>this.http
return this.http
.post<boolean>(
`${urlSplitBill}/${id}`,
{
@ -198,6 +190,6 @@ export class VoucherService {
},
options,
)
.pipe(catchError(this.log.handleError(serviceName, 'splitBill')));
.pipe(catchError(this.log.handleError(serviceName, 'splitBill'))) as Observable<boolean>;
}
}