Added Streams to TourRepository
This commit is contained in:
@ -21,6 +21,18 @@ class Payment {
|
||||
id: dto.id,
|
||||
);
|
||||
}
|
||||
|
||||
Payment copyWith({
|
||||
String? description,
|
||||
String? shortcode,
|
||||
String? id,
|
||||
}) {
|
||||
return Payment(
|
||||
description: description ?? this.description,
|
||||
shortcode: shortcode ?? this.shortcode,
|
||||
id: id ?? this.id,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Tour {
|
||||
@ -30,7 +42,7 @@ class Tour {
|
||||
required this.driver,
|
||||
required this.discountArticleNumber,
|
||||
required this.paymentMethods,
|
||||
});
|
||||
}) : deliveriesPerCar = {};
|
||||
|
||||
final DateTime date;
|
||||
final String discountArticleNumber;
|
||||
@ -38,6 +50,8 @@ class Tour {
|
||||
final List<Delivery> deliveries;
|
||||
List<Payment> paymentMethods;
|
||||
|
||||
Map<String, List<Delivery>> deliveriesPerCar;
|
||||
|
||||
int getFinishedDeliveries(int carId) {
|
||||
return deliveries
|
||||
.where((delivery) => delivery.carId == carId)
|
||||
@ -54,8 +68,9 @@ class Tour {
|
||||
List<Payment>? paymentMethods,
|
||||
}) {
|
||||
return Tour(
|
||||
date: date ?? this.date,
|
||||
discountArticleNumber: discountArticleNumber ?? this.discountArticleNumber,
|
||||
date: date ?? this.date.copyWith(),
|
||||
discountArticleNumber:
|
||||
discountArticleNumber ?? this.discountArticleNumber,
|
||||
driver: driver ?? this.driver,
|
||||
deliveries: deliveries ?? this.deliveries,
|
||||
paymentMethods: paymentMethods ?? this.paymentMethods,
|
||||
@ -84,4 +99,18 @@ class Driver {
|
||||
|
||||
return "$salutation, $name";
|
||||
}
|
||||
|
||||
Driver copyWith(
|
||||
int? teamNumber,
|
||||
String? name,
|
||||
String? salutation,
|
||||
List<Car>? cars,
|
||||
) {
|
||||
return Driver(
|
||||
teamNumber: teamNumber ?? this.teamNumber,
|
||||
name: name ?? this.name,
|
||||
salutation: salutation ?? this.salutation,
|
||||
cars: cars ?? this.cars,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user