create project
This commit is contained in:
45
frontend/lib/models/user.dart
Normal file
45
frontend/lib/models/user.dart
Normal file
@@ -0,0 +1,45 @@
|
||||
class User {
|
||||
final String id;
|
||||
final String phone;
|
||||
final String nickname;
|
||||
final String? email;
|
||||
final List<String> familyIds;
|
||||
final String? activeFamilyId;
|
||||
final String joinDate;
|
||||
final String createdAt;
|
||||
|
||||
const User({
|
||||
required this.id,
|
||||
required this.phone,
|
||||
required this.nickname,
|
||||
this.email,
|
||||
this.familyIds = const [],
|
||||
this.activeFamilyId,
|
||||
this.joinDate = '',
|
||||
this.createdAt = '',
|
||||
});
|
||||
|
||||
factory User.fromJson(Map<String, dynamic> json) {
|
||||
return User(
|
||||
id: json['id'] as String? ?? '',
|
||||
phone: json['phone'] as String? ?? '',
|
||||
nickname: json['nickname'] as String? ?? '',
|
||||
email: json['email'] as String?,
|
||||
familyIds: (json['familyIds'] as List<dynamic>?)?.cast<String>() ?? [],
|
||||
activeFamilyId: json['activeFamilyId'] as String?,
|
||||
joinDate: json['joinDate'] as String? ?? '',
|
||||
createdAt: json['createdAt'] as String? ?? '',
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'phone': phone,
|
||||
'nickname': nickname,
|
||||
'email': email,
|
||||
'familyIds': familyIds,
|
||||
'activeFamilyId': activeFamilyId,
|
||||
'joinDate': joinDate,
|
||||
'createdAt': createdAt,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user