Final commit.
This commit is contained in:
53
lib/domain/entity/tour.dart
Normal file
53
lib/domain/entity/tour.dart
Normal file
@ -0,0 +1,53 @@
|
||||
/// Aggregat-Wurzel eines Tour-Tages.
|
||||
///
|
||||
/// Die `Tour` selbst ist minimal — sie hält nur Identität und Eckdaten;
|
||||
/// die fachlich interessanten Daten (Lieferungen + Stammdaten-Lookups)
|
||||
/// sitzen in `TourDetails`. Diese Trennung erlaubt es, Touren-Listen
|
||||
/// (z. B. `/me/tours/today`) zu rendern, ohne das gesamte Aggregat
|
||||
/// laden zu müssen.
|
||||
class Tour {
|
||||
const Tour({
|
||||
required this.id,
|
||||
required this.accountId,
|
||||
required this.date,
|
||||
required this.syncedAt,
|
||||
});
|
||||
|
||||
final String id;
|
||||
final int accountId;
|
||||
final DateTime date;
|
||||
|
||||
/// Zeitpunkt des letzten ERP-Sync. Wird in der Header-Zeile als
|
||||
/// „Stand: …"-Hinweis angezeigt — wenn das ungewöhnlich alt ist, sieht
|
||||
/// der Fahrer das.
|
||||
final DateTime syncedAt;
|
||||
|
||||
Tour copyWith({
|
||||
String? id,
|
||||
int? accountId,
|
||||
DateTime? date,
|
||||
DateTime? syncedAt,
|
||||
}) {
|
||||
return Tour(
|
||||
id: id ?? this.id,
|
||||
accountId: accountId ?? this.accountId,
|
||||
date: date ?? this.date,
|
||||
syncedAt: syncedAt ?? this.syncedAt,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Tagestour-Übersicht, wie sie `/me/tours/today` liefert. Schlankes Objekt
|
||||
/// für die Initialphase (Tour-Auswahl), ohne das volle Aggregat zu
|
||||
/// transportieren.
|
||||
class TourSummary {
|
||||
const TourSummary({
|
||||
required this.tourId,
|
||||
required this.tourDate,
|
||||
required this.deliveryCount,
|
||||
});
|
||||
|
||||
final String tourId;
|
||||
final DateTime tourDate;
|
||||
final int deliveryCount;
|
||||
}
|
||||
Reference in New Issue
Block a user