diff --git a/lib/features/auth/model/user_model.dart b/lib/features/auth/model/user_model.dart index 0f50a8b..c23da27 100644 --- a/lib/features/auth/model/user_model.dart +++ b/lib/features/auth/model/user_model.dart @@ -22,7 +22,7 @@ class UserModel { final DateTime? appAgreementAcceptedAt; final Role? role; final Project? project; - + final int? points; UserModel({ required this.uuid, required this.email, @@ -41,6 +41,7 @@ class UserModel { required this.appAgreementAcceptedAt, required this.role, required this.project, + this.points, }); factory UserModel.fromJson(Map json) { @@ -67,33 +68,36 @@ class UserModel { role: json['role'] != null ? Role.fromJson(json['role']) : null, project: json['project'] != null ? Project.fromJson(json['project']) : null, + points: json['points'], ); } factory UserModel.fromToken(Token token) { Map tempJson = Token.decodeToken(token.accessToken); return UserModel( - uuid: tempJson['uuid'].toString(), - email: tempJson['email'], - lastName: tempJson['lastName'], - firstName: tempJson['firstName'], - profilePicture: UserModel.decodeBase64Image(tempJson['profilePicture']), - phoneNumber: null, - isEmailVerified: null, - isAgreementAccepted: null, - regionUuid: null, - regionName: tempJson['region']?['regionName'], - timeZone: tempJson['timezone']?['timeZoneOffset'], - hasAcceptedWebAgreement: tempJson['hasAcceptedWebAgreement'], - webAgreementAcceptedAt: tempJson['webAgreementAcceptedAt'] != null - ? DateTime.parse(tempJson['webAgreementAcceptedAt']) - : null, - hasAcceptedAppAgreement: tempJson['hasAcceptedAppAgreement'], - appAgreementAcceptedAt: tempJson['appAgreementAcceptedAt'] != null - ? DateTime.parse(tempJson['appAgreementAcceptedAt']) - : null, - role: tempJson['role'] != null ? Role.fromJson(tempJson['role']) : null, - project: null); + uuid: tempJson['uuid'].toString(), + email: tempJson['email'], + lastName: tempJson['lastName'], + firstName: tempJson['firstName'], + profilePicture: UserModel.decodeBase64Image(tempJson['profilePicture']), + phoneNumber: null, + isEmailVerified: null, + isAgreementAccepted: null, + regionUuid: null, + regionName: tempJson['region']?['regionName'], + timeZone: tempJson['timezone']?['timeZoneOffset'], + hasAcceptedWebAgreement: tempJson['hasAcceptedWebAgreement'], + webAgreementAcceptedAt: tempJson['webAgreementAcceptedAt'] != null + ? DateTime.parse(tempJson['webAgreementAcceptedAt']) + : null, + hasAcceptedAppAgreement: tempJson['hasAcceptedAppAgreement'], + appAgreementAcceptedAt: tempJson['appAgreementAcceptedAt'] != null + ? DateTime.parse(tempJson['appAgreementAcceptedAt']) + : null, + role: tempJson['role'] != null ? Role.fromJson(tempJson['role']) : null, + project: null, + points: tempJson['points'], + ); } static Uint8List? decodeBase64Image(String? base64String) {