Teat - Services - fixed models with provider_id

This commit is contained in:
2026-04-15 15:21:19 +02:00
parent 52c5eec67d
commit 61442339fe
4 changed files with 103 additions and 7 deletions

View File

@@ -7,7 +7,7 @@ class EnergyServiceModel extends Equatable {
final DateTime? createdAt;
final EnergyType type;
final DateTime expiration;
final String gestoreId;
final String providerId;
final String? serviceId;
const EnergyServiceModel({
@@ -15,7 +15,7 @@ class EnergyServiceModel extends Equatable {
this.createdAt,
required this.type,
required this.expiration,
required this.gestoreId,
required this.providerId,
this.serviceId,
});
@@ -24,7 +24,7 @@ class EnergyServiceModel extends Equatable {
DateTime? createdAt,
EnergyType? type,
DateTime? expiration,
String? gestoreId,
String? providerId,
String? serviceId,
}) {
return EnergyServiceModel(
@@ -32,7 +32,7 @@ class EnergyServiceModel extends Equatable {
createdAt: createdAt ?? this.createdAt,
type: type ?? this.type,
expiration: expiration ?? this.expiration,
gestoreId: gestoreId ?? this.gestoreId,
providerId: providerId ?? this.providerId,
serviceId: serviceId ?? this.serviceId,
);
}
@@ -43,7 +43,7 @@ class EnergyServiceModel extends Equatable {
createdAt,
type,
expiration,
gestoreId,
providerId,
serviceId,
];
@@ -55,7 +55,7 @@ class EnergyServiceModel extends Equatable {
: null,
type: map['type'] == 'gas' ? EnergyType.gas : EnergyType.luce,
expiration: DateTime.parse(map['expiration']),
gestoreId: map['gestore_id'],
providerId: map['provider_id'],
serviceId: map['service_id'],
);
}
@@ -65,7 +65,7 @@ class EnergyServiceModel extends Equatable {
if (id != null) 'id': id,
'type': type.name, // .name trasforma l'enum in 'luce' o 'gas'
'expiration': expiration.toIso8601String(),
'gestore_id': gestoreId,
'provider_id': providerId,
'service_id': serviceId,
};
}