(Feat) Migration PocketBase
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/// Un client fidélité. Le [code] est ce qui est encodé dans son QR code :
|
||||
/// scanner le QR permet de retrouver le compte.
|
||||
class Client {
|
||||
final String id; // uuid Supabase
|
||||
final String id; // id PocketBase
|
||||
|
||||
/// Code unique du compte (encodé dans le QR), ex : « FID-3F9K2A ».
|
||||
final String code;
|
||||
|
||||
@@ -41,12 +41,14 @@ class Mouvement {
|
||||
factory Mouvement.fromMap(Map<String, dynamic> map) {
|
||||
return Mouvement(
|
||||
id: map['id'].toString(),
|
||||
clientId: map['client_id'].toString(),
|
||||
type: (map['type'] as String?) ?? TypeMouvement.ajustement,
|
||||
clientId: (map['client'] ?? '').toString(),
|
||||
type: (map['type'] as String?)?.isNotEmpty == true
|
||||
? map['type'] as String
|
||||
: TypeMouvement.ajustement,
|
||||
montantEuros: (map['montant_euros'] as num?)?.toDouble(),
|
||||
points: (map['points'] as num?)?.toDouble() ?? 0,
|
||||
libelle: (map['libelle'] as String?) ?? '',
|
||||
date: DateTime.tryParse(map['created_at']?.toString() ?? '')?.toLocal() ??
|
||||
date: DateTime.tryParse(map['created']?.toString() ?? '')?.toLocal() ??
|
||||
DateTime.fromMillisecondsSinceEpoch(0),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user