Umbau auf directus API Rest Service

This commit is contained in:
2026-09-25 16:44:42 +02:00
parent 7ddcdf71bc
commit 84724ef10f
22 changed files with 570 additions and 274 deletions
+2 -2
View File
@@ -22,9 +22,9 @@ class ChartData {
for (int i = 0; i < tankList.length; i++) {
final tank = tankList[i];
final liters = double.tryParse(tank.szLiters) ?? 0.0;
final liters = double.tryParse(tank.liter) ?? 0.0;
final priceTotal = double.tryParse(tank.szPriceTotal) ?? 0.0;
final pricePerLiter = double.tryParse(tank.szPricePerLiter) ?? 0.0;
final pricePerLiter = double.tryParse(tank.pricePerLiter) ?? 0.0;
points.add(
ChartDataPoint(
+57
View File
@@ -0,0 +1,57 @@
class TankGuruDirectusModel {
int? iD;
String? userIdentId;
String? tankDate;
String? odometer;
String? liter;
String? pricePerLiter;
String? standort;
String? createdAt;
String? szPriceTotal;
TankGuruDirectusModel(
{this.iD,
this.userIdentId,
this.tankDate,
this.odometer,
this.liter,
this.pricePerLiter,
this.standort,
this.createdAt,
this.szPriceTotal});
TankGuruDirectusModel.fromJson(Map<String, dynamic> json) {
iD = json['ID'];
userIdentId = json['UserIdentId'];
tankDate = json['TankDate'];
odometer = json['Odometer'];
liter = json['Liter'];
pricePerLiter = json['PricePerLiter'];
standort = json['Standort'];
createdAt = json['CreatedAt'];
// Berechnung des Gesamtpreises
if (liter != null && pricePerLiter != null) {
double literValue = double.tryParse(liter!) ?? 0.0;
double pricePerLiterValue = double.tryParse(pricePerLiter!) ?? 0.0;
szPriceTotal = (literValue * pricePerLiterValue).toStringAsFixed(3);
} else {
szPriceTotal = '0.00';
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['ID'] = iD;
data['UserIdentId'] = userIdentId;
data['TankDate'] = tankDate;
data['Odometer'] = odometer;
data['Liter'] = liter;
data['PricePerLiter'] = pricePerLiter;
data['Standort'] = standort;
data['CreatedAt'] = createdAt;
data['SzPriceTotal'] = szPriceTotal;
return data;
}
}
+44
View File
@@ -0,0 +1,44 @@
class TankUser {
int? iD;
String? userIdentId;
String? userName;
String? city;
String? country;
String? email;
String? passwordHash;
String? createdAt;
TankUser(
{this.iD,
this.userIdentId,
this.userName,
this.city,
this.country,
this.email,
this.passwordHash,
this.createdAt});
TankUser.fromJson(Map<String, dynamic> json) {
iD = json['ID'];
userIdentId = json['UserIdentId'];
userName = json['UserName'];
city = json['City'];
country = json['Country'];
email = json['Email'];
passwordHash = json['PasswordHash'];
createdAt = json['CreatedAt'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['ID'] = iD;
data['UserIdentId'] = userIdentId;
data['UserName'] = userName;
data['City'] = city;
data['Country'] = country;
data['Email'] = email;
data['PasswordHash'] = passwordHash;
data['CreatedAt'] = createdAt;
return data;
}
}