회원목록
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
class Member {
|
||||
final String id;
|
||||
final String userId;
|
||||
final String clubId;
|
||||
final String name;
|
||||
final String email;
|
||||
final String? role;
|
||||
final String? profileImage;
|
||||
final String? phone;
|
||||
final String? address;
|
||||
final DateTime? joinDate;
|
||||
final bool isActive;
|
||||
final String? gender;
|
||||
final String? memberType;
|
||||
final int? handicap;
|
||||
final String? status;
|
||||
final DateTime? createdAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
Member({
|
||||
required this.id,
|
||||
required this.userId,
|
||||
required this.clubId,
|
||||
required this.name,
|
||||
required this.email,
|
||||
this.role,
|
||||
this.profileImage,
|
||||
this.phone,
|
||||
this.address,
|
||||
this.joinDate,
|
||||
required this.isActive,
|
||||
this.gender,
|
||||
this.memberType,
|
||||
this.handicap,
|
||||
this.status,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
// JSON 데이터로부터 Member 객체 생성
|
||||
factory Member.fromJson(Map<String, dynamic> json) {
|
||||
return Member(
|
||||
id: json['id']?.toString() ?? '',
|
||||
userId: json['userId']?.toString() ?? '',
|
||||
clubId: json['clubId']?.toString() ?? '',
|
||||
name: json['name'] ?? '',
|
||||
email: json['email'] ?? '',
|
||||
role: json['role']?.toString(),
|
||||
profileImage: json['profileImage']?.toString(),
|
||||
phone: json['phone']?.toString(),
|
||||
address: json['address']?.toString(),
|
||||
joinDate: json['joinDate'] != null ? DateTime.parse(json['joinDate'].toString()) : null,
|
||||
isActive: json['isActive'] ?? true,
|
||||
gender: json['gender']?.toString(),
|
||||
memberType: json['memberType']?.toString(),
|
||||
handicap: json['handicap'] != null ? int.tryParse(json['handicap'].toString()) : null,
|
||||
status: json['status']?.toString(),
|
||||
createdAt: json['createdAt'] != null ? DateTime.parse(json['createdAt'].toString()) : null,
|
||||
updatedAt: json['updatedAt'] != null ? DateTime.parse(json['updatedAt'].toString()) : null,
|
||||
);
|
||||
}
|
||||
|
||||
// Member 객체를 JSON으로 변환
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
'userId': userId,
|
||||
'clubId': clubId,
|
||||
'name': name,
|
||||
'email': email,
|
||||
'role': role,
|
||||
'profileImage': profileImage,
|
||||
'phone': phone,
|
||||
'address': address,
|
||||
'joinDate': joinDate?.toIso8601String(),
|
||||
'isActive': isActive,
|
||||
'gender': gender,
|
||||
'memberType': memberType,
|
||||
'handicap': handicap,
|
||||
'status': status,
|
||||
'createdAt': createdAt?.toIso8601String(),
|
||||
'updatedAt': updatedAt?.toIso8601String(),
|
||||
};
|
||||
}
|
||||
|
||||
// 객체 복사 및 특정 필드 업데이트를 위한 copyWith 메서드
|
||||
Member copyWith({
|
||||
String? id,
|
||||
String? userId,
|
||||
String? clubId,
|
||||
String? name,
|
||||
String? email,
|
||||
String? role,
|
||||
String? profileImage,
|
||||
String? phone,
|
||||
String? address,
|
||||
DateTime? joinDate,
|
||||
bool? isActive,
|
||||
String? gender,
|
||||
String? memberType,
|
||||
int? handicap,
|
||||
String? status,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
}) {
|
||||
return Member(
|
||||
id: id ?? this.id,
|
||||
userId: userId ?? this.userId,
|
||||
clubId: clubId ?? this.clubId,
|
||||
name: name ?? this.name,
|
||||
email: email ?? this.email,
|
||||
role: role ?? this.role,
|
||||
profileImage: profileImage ?? this.profileImage,
|
||||
phone: phone ?? this.phone,
|
||||
address: address ?? this.address,
|
||||
joinDate: joinDate ?? this.joinDate,
|
||||
isActive: isActive ?? this.isActive,
|
||||
gender: gender ?? this.gender,
|
||||
memberType: memberType ?? this.memberType,
|
||||
handicap: handicap ?? this.handicap,
|
||||
status: status ?? this.status,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
updatedAt: updatedAt ?? this.updatedAt,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user