91 lines
2.0 KiB
Dart
91 lines
2.0 KiB
Dart
class Role {
|
|
final int id;
|
|
final String name;
|
|
|
|
Role({
|
|
required this.id,
|
|
required this.name,
|
|
});
|
|
|
|
factory Role.fromJson(Map<String, dynamic> json) {
|
|
return Role(
|
|
id: json['id'],
|
|
name: json['name'],
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'id': id,
|
|
'name': name,
|
|
};
|
|
}
|
|
}
|
|
|
|
class UserDetails {
|
|
final int id;
|
|
final String fullName;
|
|
final String email;
|
|
final String phone;
|
|
final String round;
|
|
final Role role;
|
|
final bool isActive;
|
|
final bool isDeleted;
|
|
final String lastLoginAt;
|
|
final String joinDate;
|
|
final String createdAtRaw;
|
|
final String updatedAt;
|
|
final String updatedAtRaw;
|
|
|
|
UserDetails({
|
|
required this.id,
|
|
required this.fullName,
|
|
required this.email,
|
|
required this.phone,
|
|
required this.round,
|
|
required this.role,
|
|
required this.isActive,
|
|
required this.isDeleted,
|
|
required this.lastLoginAt,
|
|
required this.joinDate,
|
|
required this.createdAtRaw,
|
|
required this.updatedAt,
|
|
required this.updatedAtRaw,
|
|
});
|
|
|
|
factory UserDetails.fromJson(Map<String, dynamic> json) {
|
|
return UserDetails(
|
|
id: json['id'],
|
|
fullName: json['fullName'] ?? '',
|
|
email: json['email'] ?? '',
|
|
phone: json['phone'] ?? '',
|
|
round: json['round'] ?? '',
|
|
role: Role.fromJson(json['role']),
|
|
isActive: json['isActive'] ?? false,
|
|
isDeleted: json['isDeleted'] ?? false,
|
|
lastLoginAt: json['lastLoginAt'] ?? '',
|
|
joinDate: json['joinDate'] ?? '',
|
|
createdAtRaw: json['createdAtRaw'] ?? '',
|
|
updatedAt: json['updatedAt'] ?? '',
|
|
updatedAtRaw: json['updatedAtRaw'] ?? '',
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'id': id,
|
|
'fullName': fullName,
|
|
'email': email,
|
|
'phone': phone,
|
|
'round': round,
|
|
'role': role.toJson(),
|
|
'isActive': isActive,
|
|
'isDeleted': isDeleted,
|
|
'lastLoginAt': lastLoginAt,
|
|
'joinDate': joinDate,
|
|
'createdAtRaw': createdAtRaw,
|
|
'updatedAt': updatedAt,
|
|
'updatedAtRaw': updatedAtRaw,
|
|
};
|
|
}
|
|
} |