second commit
This commit is contained in:
38
lib/domain/repositories/sync_repository.dart
Normal file
38
lib/domain/repositories/sync_repository.dart
Normal file
@@ -0,0 +1,38 @@
|
||||
import '../entities/shift_report.dart';
|
||||
import '../entities/sync_event.dart';
|
||||
|
||||
/// The terminal's two network touchpoints, plus the durable event log.
|
||||
abstract class SyncRepository {
|
||||
/// True once products have been pulled onto this terminal.
|
||||
bool get hasCatalogue;
|
||||
|
||||
DateTime? get lastImportAt;
|
||||
String? get catalogueRevision;
|
||||
|
||||
/// Pulls the catalogue and writes it locally.
|
||||
///
|
||||
/// Records a [SyncEventType.catalogueImport] event whether or not it
|
||||
/// succeeds, so the log reflects every attempt.
|
||||
Future<SyncEvent> importCatalogue({
|
||||
void Function(double progress, String stage)? onProgress,
|
||||
});
|
||||
|
||||
/// Builds the day's report from locally stored sales.
|
||||
ShiftReport buildShiftReport({
|
||||
required DateTime businessDate,
|
||||
required String terminalId,
|
||||
required String cashierName,
|
||||
});
|
||||
|
||||
/// Queues the report and attempts to push it.
|
||||
///
|
||||
/// On failure the event is kept in [SyncStatus.failed] so nothing is lost.
|
||||
Future<SyncEvent> pushShiftReport(ShiftReport report);
|
||||
|
||||
/// Retries a previously failed or pending push.
|
||||
Future<SyncEvent> retry(String eventId);
|
||||
|
||||
List<SyncEvent> get events;
|
||||
|
||||
bool get hasUnsyncedEvents;
|
||||
}
|
||||
Reference in New Issue
Block a user