DB Integrity checks for batch integrity and also updates quantities when it can.

This commit is contained in:
tanshu committed 2021-09-21 09:54:11 +05:30
1 parent 6212eead20
commit b1557bef88
5 files changed
+206 -15

No files matched your search

+12 -2
View File
@@ -6,6 +6,7 @@ import { catchError } from 'rxjs/operators';
import { ErrorLoggerService } from '../core/error-logger.service';
import { Product } from '../core/product';
import { BatchDate, IntegrityBatch } from './integrity-batch';
import { LockInfo } from './lock-info';
const serviceName = 'SettingsService';
@@ -82,12 +83,21 @@ export class SettingsService {
}>;
}
checkDatabaseIntegrity(): Observable<{ attendanceCount: number }> {
checkDatabaseIntegrity(): Observable<{
attendanceCount: number;
batches: IntegrityBatch[];
batchDates: BatchDate[];
}> {
const url = '/api/db-integrity';
return this.http
.post<{ attendanceCount: number }>(url, {})
.post<{ attendanceCount: number; batches: IntegrityBatch[]; batchDates: BatchDate[] }>(
url,
{},
)
.pipe(catchError(this.log.handleError(serviceName, 'checkDatabaseIntegrity'))) as Observable<{
attendanceCount: number;
batches: IntegrityBatch[];
batchDates: BatchDate[];
}>;
}
}