first commit
This commit is contained in:
109
app/lib/domain/repositories/tour_repository.dart
Normal file
109
app/lib/domain/repositories/tour_repository.dart
Normal file
@@ -0,0 +1,109 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import '../entities/tour.dart';
|
||||
import '../entities/logistic_object.dart';
|
||||
import '../entities/location.dart';
|
||||
import '../entities/counter.dart';
|
||||
import '../../core/errors/failures.dart';
|
||||
|
||||
abstract class TourRepository {
|
||||
// Touren
|
||||
Future<Either<Failure, List<Tour>>> getTours();
|
||||
Future<Either<Failure, Tour>> getTourById(int tourId);
|
||||
Future<Either<Failure, void>> updateTourState(int tourId, int state);
|
||||
Future<Either<Failure, void>> completeTour(int tourId);
|
||||
|
||||
// Sync
|
||||
Future<Either<Failure, void>> syncData();
|
||||
Future<Either<Failure, bool>> checkForUpdates();
|
||||
|
||||
// Objects
|
||||
Future<Either<Failure, List<LogisticObject>>> getObjectsByTour(int tourId);
|
||||
Future<Either<Failure, List<LogisticObject>>> getObjectsByState(String state);
|
||||
Future<Either<Failure, LogisticObject?>> getObjectByBarcode(String barcode);
|
||||
Future<Either<Failure, void>> updateObjectState(
|
||||
int objectId,
|
||||
String newState, {
|
||||
int? locationId,
|
||||
int? refType,
|
||||
int? refId,
|
||||
String? containerCode,
|
||||
});
|
||||
Future<Either<Failure, void>> createObject({
|
||||
required int type,
|
||||
required String code,
|
||||
bool isManual = true,
|
||||
});
|
||||
|
||||
// Locations
|
||||
Future<Either<Failure, List<Location>>> getLocations();
|
||||
Future<Either<Failure, Location>> getLocationById(int locationId);
|
||||
|
||||
// Metadata
|
||||
Future<Either<Failure, List<ObjectMetadata>>> getObjectMetadata();
|
||||
|
||||
// Statistics
|
||||
Future<Either<Failure, TourStatistics>> getTourStatistics(int tourId);
|
||||
Future<Either<Failure, ObjectStatistics>> getObjectStatistics();
|
||||
|
||||
// Counter operations (spezifisch für Lua-kompatible Ansichten)
|
||||
Future<Either<Failure, CounterOverview>> getCounterOverview(
|
||||
int tourId,
|
||||
String tourType, {
|
||||
String? pageId,
|
||||
});
|
||||
|
||||
Future<Either<Failure, List<PickupCount>>> getPickupCounts(int tourId, String pageId);
|
||||
Future<Either<Failure, List<SwapCount>>> getSwapCounts(int tourId, String pageId);
|
||||
|
||||
// Container operations
|
||||
Future<Either<Failure, List<ContainerInfo>>> getOpenContainers();
|
||||
Future<Either<Failure, void>> addObjectToContainer(
|
||||
String containerId,
|
||||
String containerType,
|
||||
int objectId,
|
||||
);
|
||||
Future<Either<Failure, void>> closeContainer(
|
||||
String containerId,
|
||||
String containerType,
|
||||
);
|
||||
|
||||
// Recent scans
|
||||
Future<Either<Failure, List<RecentScan>>> getRecentScans(
|
||||
int tourId, {
|
||||
int limit = 10,
|
||||
});
|
||||
}
|
||||
|
||||
class TourStatistics {
|
||||
final int totalObjects;
|
||||
final int completedObjects;
|
||||
final int pendingObjects;
|
||||
final Map<String, int> objectsByState;
|
||||
final Map<String, int> objectsByType;
|
||||
final double completionPercentage;
|
||||
|
||||
const TourStatistics({
|
||||
required this.totalObjects,
|
||||
required this.completedObjects,
|
||||
required this.pendingObjects,
|
||||
required this.objectsByState,
|
||||
required this.objectsByType,
|
||||
required this.completionPercentage,
|
||||
});
|
||||
}
|
||||
|
||||
class ObjectStatistics {
|
||||
final Map<String, int> byState;
|
||||
final Map<String, int> byType;
|
||||
final Map<String, int> byLocation;
|
||||
final List<LogisticObject> recentObjects;
|
||||
final int totalCount;
|
||||
|
||||
const ObjectStatistics({
|
||||
required this.byState,
|
||||
required this.byType,
|
||||
required this.byLocation,
|
||||
required this.recentObjects,
|
||||
required this.totalCount,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user