이벤트 개발완료

This commit is contained in:
2025-10-23 22:04:03 +09:00
parent ce1aee67d6
commit cd0e139b5e
48 changed files with 7855 additions and 3459 deletions
+17 -2
View File
@@ -53,12 +53,14 @@ class Event {
startDate: json['startDate'] != null ? DateTime.parse(json['startDate'].toString()) : DateTime.now(),
endDate: json['endDate'] != null ? DateTime.parse(json['endDate'].toString()) : null,
location: json['location']?.toString(),
type: json['type']?.toString(),
// 서버는 eventType 키를 사용할 수 있으므로 보강
type: (json['type'] ?? json['eventType'])?.toString(),
status: json['status']?.toString(),
maxParticipants: json['maxParticipants'],
currentParticipants: json['currentParticipants'],
gameCount: json['gameCount'],
participantFee: json['participantFee'] != null ? double.tryParse(json['participantFee'].toString()) : null,
// 참가비: 서버가 "0"/"0.00" 등으로 기본화할 수 있어 0은 null로 간주
participantFee: Event._parseParticipantFeeOrNull(json['participantFee']),
registrationDeadline: json['registrationDeadline'] != null ? DateTime.parse(json['registrationDeadline'].toString()) : null,
publicHash: json['publicHash']?.toString(),
accessPassword: json['accessPassword']?.toString(),
@@ -69,6 +71,19 @@ class Event {
);
}
// 참가비 파싱 헬퍼: null/빈문자열/0/"0.00" 모두 null로 간주
static double? _parseParticipantFeeOrNull(dynamic value) {
if (value == null) return null;
final s = value.toString().trim();
if (s.isEmpty) return null;
final d = double.tryParse(s);
if (d == null) return null;
// 0도 유효한 값으로 취급하여 표시되도록 그대로 반환
return d;
}
// Event 객체를 JSON으로 변환
Map<String, dynamic> toJson() {
return {