tdd 진행
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
class Participant {
|
||||
final String id;
|
||||
final String eventId;
|
||||
final String memberId;
|
||||
final String? name;
|
||||
final String? email;
|
||||
final String? phoneNumber;
|
||||
final String? status; // 'registered', 'confirmed', 'cancelled', 'attended'
|
||||
final DateTime? registeredAt;
|
||||
final DateTime? confirmedAt;
|
||||
final DateTime? cancelledAt;
|
||||
final DateTime? attendedAt;
|
||||
final bool isPaid;
|
||||
final double? paidAmount;
|
||||
final String? notes;
|
||||
final DateTime? createdAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
Participant({
|
||||
required this.id,
|
||||
required this.eventId,
|
||||
required this.memberId,
|
||||
this.name,
|
||||
this.email,
|
||||
this.phoneNumber,
|
||||
this.status,
|
||||
this.registeredAt,
|
||||
this.confirmedAt,
|
||||
this.cancelledAt,
|
||||
this.attendedAt,
|
||||
this.isPaid = false,
|
||||
this.paidAmount,
|
||||
this.notes,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
// JSON 데이터로부터 Participant 객체 생성
|
||||
factory Participant.fromJson(Map<String, dynamic> json) {
|
||||
return Participant(
|
||||
id: json['id']?.toString() ?? '',
|
||||
eventId: json['eventId']?.toString() ?? '',
|
||||
memberId: json['memberId']?.toString() ?? '',
|
||||
name: json['name']?.toString(),
|
||||
email: json['email']?.toString(),
|
||||
phoneNumber: json['phoneNumber']?.toString(),
|
||||
status: json['status']?.toString(),
|
||||
registeredAt: json['registeredAt'] != null ? DateTime.parse(json['registeredAt'].toString()) : null,
|
||||
confirmedAt: json['confirmedAt'] != null ? DateTime.parse(json['confirmedAt'].toString()) : null,
|
||||
cancelledAt: json['cancelledAt'] != null ? DateTime.parse(json['cancelledAt'].toString()) : null,
|
||||
attendedAt: json['attendedAt'] != null ? DateTime.parse(json['attendedAt'].toString()) : null,
|
||||
isPaid: json['isPaid'] ?? false,
|
||||
paidAmount: json['paidAmount'] != null ? double.tryParse(json['paidAmount'].toString()) : null,
|
||||
notes: json['notes']?.toString(),
|
||||
createdAt: json['createdAt'] != null ? DateTime.parse(json['createdAt'].toString()) : null,
|
||||
updatedAt: json['updatedAt'] != null ? DateTime.parse(json['updatedAt'].toString()) : null,
|
||||
);
|
||||
}
|
||||
|
||||
// Participant 객체를 JSON으로 변환
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
'eventId': eventId,
|
||||
'memberId': memberId,
|
||||
'name': name,
|
||||
'email': email,
|
||||
'phoneNumber': phoneNumber,
|
||||
'status': status,
|
||||
'registeredAt': registeredAt?.toIso8601String(),
|
||||
'confirmedAt': confirmedAt?.toIso8601String(),
|
||||
'cancelledAt': cancelledAt?.toIso8601String(),
|
||||
'attendedAt': attendedAt?.toIso8601String(),
|
||||
'isPaid': isPaid,
|
||||
'paidAmount': paidAmount,
|
||||
'notes': notes,
|
||||
'createdAt': createdAt?.toIso8601String(),
|
||||
'updatedAt': updatedAt?.toIso8601String(),
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user