LCOV - code coverage report

Current view: | top level - lib/models - member_model.dart |  |  | Coverage | Total | Hit
Test: | lcov.info |  | Lines: | 95.1 % | 61 | 58
Test Date: | 2025-08-12 03:21:51 |  | Functions: | - | 0 | 0

                Line data    Source code

           1              : class Member {
           2              :   final String id;
           3              :   final String userId;
           4              :   final String clubId;
           5              :   final String name;
           6              :   final String email;
           7              :   final String? role;
           8              :   final String? profileImage;
           9              :   final String? phone;
          10              :   final String? address;
          11              :   final DateTime? joinDate;
          12              :   final bool isActive;
          13              :   final String? gender;
          14              :   final String? memberType;
          15              :   final int? handicap;
          16              :   final String? status;
          17              :   final DateTime? createdAt;
          18              :   final DateTime? updatedAt;
          19              :   final DateTime? birthDate; // 생년월일 추가
          20              :
          21            5 :   Member({
          22              :     required this.id,
          23              :     required this.userId,
          24              :     required this.clubId,
          25              :     required this.name,
          26              :     required this.email,
          27              :     this.role,
          28              :     this.profileImage,
          29              :     this.phone,
          30              :     this.address,
          31              :     this.joinDate,
          32              :     required this.isActive,
          33              :     this.gender,
          34              :     this.memberType,
          35              :     this.handicap,
          36              :     this.status,
          37              :     this.createdAt,
          38              :     this.updatedAt,
          39              :     this.birthDate,
          40              :   });
          41              :
          42              :   // JSON 데이터로부터 Member 객체 생성
          43            3 :   factory Member.fromJson(Map<String, dynamic> json) {
          44            3 :     return Member(
          45            6 :       id: json['id']?.toString() ?? '',
          46            4 :       userId: json['userId']?.toString() ?? '',
          47            6 :       clubId: json['clubId']?.toString() ?? '',
          48            3 :       name: json['name'] ?? '',
          49            3 :       email: json['email'] ?? '',
          50            4 :       role: json['role']?.toString(),
          51            4 :       profileImage: json['profileImage']?.toString(),
          52            6 :       phone: json['phone']?.toString(),
          53            4 :       address: json['address']?.toString(),
          54           12 :       joinDate: json['joinDate'] != null ? DateTime.parse(json['joinDate'].toString()) : null,
          55            3 :       isActive: json['isActive'] ?? true,
          56            6 :       gender: json['gender']?.toString(),
          57            4 :       memberType: json['memberType']?.toString(),
          58            6 :       handicap: json['handicap'] != null ? int.tryParse(json['handicap'].toString()) : null,
          59            4 :       status: json['status']?.toString(),
          60            6 :       createdAt: json['createdAt'] != null ? DateTime.parse(json['createdAt'].toString()) : null,
          61            6 :       updatedAt: json['updatedAt'] != null ? DateTime.parse(json['updatedAt'].toString()) : null,
          62            3 :       birthDate: json['birthDate'] != null ? DateTime.parse(json['birthDate'].toString()) : null,
          63              :     );
          64              :   }
          65              :
          66              :   // Member 객체를 JSON으로 변환
          67            1 :   Map<String, dynamic> toJson() {
          68            1 :     return {
          69            1 :       'id': id,
          70            1 :       'userId': userId,
          71            1 :       'clubId': clubId,
          72            1 :       'name': name,
          73            1 :       'email': email,
          74            1 :       'role': role,
          75            1 :       'profileImage': profileImage,
          76            1 :       'phone': phone,
          77            1 :       'address': address,
          78            2 :       'joinDate': joinDate?.toIso8601String(),
          79            1 :       'isActive': isActive,
          80            1 :       'gender': gender,
          81            1 :       'memberType': memberType,
          82            1 :       'handicap': handicap,
          83            1 :       'status': status,
          84            2 :       'createdAt': createdAt?.toIso8601String(),
          85            2 :       'updatedAt': updatedAt?.toIso8601String(),
          86            1 :       'birthDate': birthDate?.toIso8601String(),
          87              :     };
          88              :   }
          89              :
          90              :   // 객체 복사 및 특정 필드 업데이트를 위한 copyWith 메서드
          91            1 :   Member copyWith({
          92              :     String? id,
          93              :     String? userId,
          94              :     String? clubId,
          95              :     String? name,
          96              :     String? email,
          97              :     String? role,
          98              :     String? profileImage,
          99              :     String? phone,
         100              :     String? address,
         101              :     DateTime? joinDate,
         102              :     bool? isActive,
         103              :     String? gender,
         104              :     String? memberType,
         105              :     int? handicap,
         106              :     String? status,
         107              :     DateTime? createdAt,
         108              :     DateTime? updatedAt,
         109              :     DateTime? birthDate,
         110              :   }) {
         111            1 :     return Member(
         112            1 :       id: id ?? this.id,
         113            1 :       userId: userId ?? this.userId,
         114            1 :       clubId: clubId ?? this.clubId,
         115            0 :       name: name ?? this.name,
         116            0 :       email: email ?? this.email,
         117            0 :       role: role ?? this.role,
         118            1 :       profileImage: profileImage ?? this.profileImage,
         119            1 :       phone: phone ?? this.phone,
         120            1 :       address: address ?? this.address,
         121            1 :       joinDate: joinDate ?? this.joinDate,
         122            1 :       isActive: isActive ?? this.isActive,
         123            1 :       gender: gender ?? this.gender,
         124            1 :       memberType: memberType ?? this.memberType,
         125            1 :       handicap: handicap ?? this.handicap,
         126            1 :       status: status ?? this.status,
         127            1 :       createdAt: createdAt ?? this.createdAt,
         128            1 :       updatedAt: updatedAt ?? this.updatedAt,
         129            1 :       birthDate: birthDate ?? this.birthDate,
         130              :     );
         131              :   }
         132              : }

Generated by: LCOV version 2.3.1-1