프로젝트 최초 커밋
This commit is contained in:
50
lib/models/user_model.dart
Normal file
50
lib/models/user_model.dart
Normal file
@@ -0,0 +1,50 @@
|
||||
class User {
|
||||
final int? id;
|
||||
final int companyId;
|
||||
final int? branchId; // 지점 ID
|
||||
final String name;
|
||||
final String role; // 관리등급: S(관리자), M(멤버)
|
||||
final String? position; // 직급
|
||||
final String? email; // 이메일
|
||||
final List<Map<String, String>> phoneNumbers; // 전화번호 목록 (유형과 번호)
|
||||
|
||||
User({
|
||||
this.id,
|
||||
required this.companyId,
|
||||
this.branchId,
|
||||
required this.name,
|
||||
required this.role,
|
||||
this.position,
|
||||
this.email,
|
||||
this.phoneNumbers = const [],
|
||||
});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
'companyId': companyId,
|
||||
'branchId': branchId,
|
||||
'name': name,
|
||||
'role': role,
|
||||
'position': position,
|
||||
'email': email,
|
||||
'phoneNumbers': phoneNumbers,
|
||||
};
|
||||
}
|
||||
|
||||
factory User.fromJson(Map<String, dynamic> json) {
|
||||
return User(
|
||||
id: json['id'],
|
||||
companyId: json['companyId'],
|
||||
branchId: json['branchId'],
|
||||
name: json['name'],
|
||||
role: json['role'],
|
||||
position: json['position'],
|
||||
email: json['email'],
|
||||
phoneNumbers:
|
||||
json['phoneNumbers'] != null
|
||||
? List<Map<String, String>>.from(json['phoneNumbers'])
|
||||
: [],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user