43 lines
1.1 KiB
Dart
43 lines
1.1 KiB
Dart
class AppUser {
|
|
final String id;
|
|
final String email;
|
|
final String role;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
final bool changementMdpObligatoire;
|
|
|
|
AppUser({
|
|
required this.id,
|
|
required this.email,
|
|
required this.role,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
this.changementMdpObligatoire = false,
|
|
});
|
|
|
|
factory AppUser.fromJson(Map<String, dynamic> json) {
|
|
return AppUser(
|
|
id: json['id'] as String,
|
|
email: json['email'] as String,
|
|
role: json['role'] as String,
|
|
createdAt: json['createdAt'] != null
|
|
? DateTime.parse(json['createdAt'] as String)
|
|
: DateTime.now(),
|
|
updatedAt: json['updatedAt'] != null
|
|
? DateTime.parse(json['updatedAt'] as String)
|
|
: DateTime.now(),
|
|
changementMdpObligatoire: json['changement_mdp_obligatoire'] as bool? ?? false,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'id': id,
|
|
'email': email,
|
|
'role': role,
|
|
'createdAt': createdAt.toIso8601String(),
|
|
'updatedAt': updatedAt.toIso8601String(),
|
|
'changement_mdp_obligatoire': changementMdpObligatoire,
|
|
};
|
|
}
|
|
} |