mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 09:45:22 +00:00
add points to user model
This commit is contained in:
@ -22,7 +22,7 @@ class UserModel {
|
|||||||
final DateTime? appAgreementAcceptedAt;
|
final DateTime? appAgreementAcceptedAt;
|
||||||
final Role? role;
|
final Role? role;
|
||||||
final Project? project;
|
final Project? project;
|
||||||
|
final int? points;
|
||||||
UserModel({
|
UserModel({
|
||||||
required this.uuid,
|
required this.uuid,
|
||||||
required this.email,
|
required this.email,
|
||||||
@ -41,6 +41,7 @@ class UserModel {
|
|||||||
required this.appAgreementAcceptedAt,
|
required this.appAgreementAcceptedAt,
|
||||||
required this.role,
|
required this.role,
|
||||||
required this.project,
|
required this.project,
|
||||||
|
this.points,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory UserModel.fromJson(Map<String, dynamic> json) {
|
factory UserModel.fromJson(Map<String, dynamic> json) {
|
||||||
@ -67,33 +68,36 @@ class UserModel {
|
|||||||
role: json['role'] != null ? Role.fromJson(json['role']) : null,
|
role: json['role'] != null ? Role.fromJson(json['role']) : null,
|
||||||
project:
|
project:
|
||||||
json['project'] != null ? Project.fromJson(json['project']) : null,
|
json['project'] != null ? Project.fromJson(json['project']) : null,
|
||||||
|
points: json['points'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
factory UserModel.fromToken(Token token) {
|
factory UserModel.fromToken(Token token) {
|
||||||
Map<String, dynamic> tempJson = Token.decodeToken(token.accessToken);
|
Map<String, dynamic> tempJson = Token.decodeToken(token.accessToken);
|
||||||
return UserModel(
|
return UserModel(
|
||||||
uuid: tempJson['uuid'].toString(),
|
uuid: tempJson['uuid'].toString(),
|
||||||
email: tempJson['email'],
|
email: tempJson['email'],
|
||||||
lastName: tempJson['lastName'],
|
lastName: tempJson['lastName'],
|
||||||
firstName: tempJson['firstName'],
|
firstName: tempJson['firstName'],
|
||||||
profilePicture: UserModel.decodeBase64Image(tempJson['profilePicture']),
|
profilePicture: UserModel.decodeBase64Image(tempJson['profilePicture']),
|
||||||
phoneNumber: null,
|
phoneNumber: null,
|
||||||
isEmailVerified: null,
|
isEmailVerified: null,
|
||||||
isAgreementAccepted: null,
|
isAgreementAccepted: null,
|
||||||
regionUuid: null,
|
regionUuid: null,
|
||||||
regionName: tempJson['region']?['regionName'],
|
regionName: tempJson['region']?['regionName'],
|
||||||
timeZone: tempJson['timezone']?['timeZoneOffset'],
|
timeZone: tempJson['timezone']?['timeZoneOffset'],
|
||||||
hasAcceptedWebAgreement: tempJson['hasAcceptedWebAgreement'],
|
hasAcceptedWebAgreement: tempJson['hasAcceptedWebAgreement'],
|
||||||
webAgreementAcceptedAt: tempJson['webAgreementAcceptedAt'] != null
|
webAgreementAcceptedAt: tempJson['webAgreementAcceptedAt'] != null
|
||||||
? DateTime.parse(tempJson['webAgreementAcceptedAt'])
|
? DateTime.parse(tempJson['webAgreementAcceptedAt'])
|
||||||
: null,
|
: null,
|
||||||
hasAcceptedAppAgreement: tempJson['hasAcceptedAppAgreement'],
|
hasAcceptedAppAgreement: tempJson['hasAcceptedAppAgreement'],
|
||||||
appAgreementAcceptedAt: tempJson['appAgreementAcceptedAt'] != null
|
appAgreementAcceptedAt: tempJson['appAgreementAcceptedAt'] != null
|
||||||
? DateTime.parse(tempJson['appAgreementAcceptedAt'])
|
? DateTime.parse(tempJson['appAgreementAcceptedAt'])
|
||||||
: null,
|
: null,
|
||||||
role: tempJson['role'] != null ? Role.fromJson(tempJson['role']) : null,
|
role: tempJson['role'] != null ? Role.fromJson(tempJson['role']) : null,
|
||||||
project: null);
|
project: null,
|
||||||
|
points: tempJson['points'],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Uint8List? decodeBase64Image(String? base64String) {
|
static Uint8List? decodeBase64Image(String? base64String) {
|
||||||
|
Reference in New Issue
Block a user