mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 18:16:21 +00:00
remove role model
This commit is contained in:
@ -307,10 +307,10 @@ class HomeCubit extends Cubit<HomeState> {
|
|||||||
} on DioException catch (e) {
|
} on DioException catch (e) {
|
||||||
final errorMessage = e.response?.data['error']['message'];
|
final errorMessage = e.response?.data['error']['message'];
|
||||||
emitSafe(ActivationError(errMessage: errorMessage));
|
emitSafe(ActivationError(errMessage: errorMessage));
|
||||||
return errorMessage;
|
return false;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emitSafe(ActivationError(errMessage: e.toString()));
|
emitSafe(ActivationError(errMessage: e.toString()));
|
||||||
return e.toString();
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,38 +2,6 @@ import 'dart:convert';
|
|||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:syncrow_app/features/auth/model/token.dart';
|
import 'package:syncrow_app/features/auth/model/token.dart';
|
||||||
|
|
||||||
class Role {
|
|
||||||
final String uuid;
|
|
||||||
final DateTime createdAt;
|
|
||||||
final DateTime updatedAt;
|
|
||||||
final String type;
|
|
||||||
|
|
||||||
Role({
|
|
||||||
required this.uuid,
|
|
||||||
required this.createdAt,
|
|
||||||
required this.updatedAt,
|
|
||||||
required this.type,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory Role.fromJson(Map<String, dynamic> json) {
|
|
||||||
return Role(
|
|
||||||
uuid: json['uuid'],
|
|
||||||
createdAt: DateTime.parse(json['createdAt']),
|
|
||||||
updatedAt: DateTime.parse(json['updatedAt']),
|
|
||||||
type: json['type'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
return {
|
|
||||||
'uuid': uuid,
|
|
||||||
'createdAt': createdAt.toIso8601String(),
|
|
||||||
'updatedAt': updatedAt.toIso8601String(),
|
|
||||||
'type': type,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class UserModel {
|
class UserModel {
|
||||||
static String userUuidKey = 'userUuid';
|
static String userUuidKey = 'userUuid';
|
||||||
final String? uuid;
|
final String? uuid;
|
||||||
@ -47,7 +15,6 @@ class UserModel {
|
|||||||
final String? timeZone;
|
final String? timeZone;
|
||||||
final String? regionUuid;
|
final String? regionUuid;
|
||||||
final bool? isAgreementAccepted;
|
final bool? isAgreementAccepted;
|
||||||
final Role? role;
|
|
||||||
|
|
||||||
UserModel({
|
UserModel({
|
||||||
required this.uuid,
|
required this.uuid,
|
||||||
@ -61,7 +28,7 @@ class UserModel {
|
|||||||
required this.isAgreementAccepted,
|
required this.isAgreementAccepted,
|
||||||
required this.regionName,
|
required this.regionName,
|
||||||
required this.timeZone,
|
required this.timeZone,
|
||||||
required this.role,
|
// required this.role,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory UserModel.fromJson(Map<String, dynamic> json) {
|
factory UserModel.fromJson(Map<String, dynamic> json) {
|
||||||
@ -77,7 +44,6 @@ class UserModel {
|
|||||||
regionName: json['region']?['regionName'],
|
regionName: json['region']?['regionName'],
|
||||||
timeZone: json['timeZone']?['timeZoneOffset'],
|
timeZone: json['timeZone']?['timeZoneOffset'],
|
||||||
regionUuid: json['region']?['uuid'],
|
regionUuid: json['region']?['uuid'],
|
||||||
role: json['role'] != null ? Role.fromJson(json['role']) : null,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +61,6 @@ class UserModel {
|
|||||||
regionUuid: null,
|
regionUuid: null,
|
||||||
regionName: tempJson['region']?['regionName'],
|
regionName: tempJson['region']?['regionName'],
|
||||||
timeZone: tempJson['timezone']?['timeZoneOffset'],
|
timeZone: tempJson['timezone']?['timeZoneOffset'],
|
||||||
role: tempJson['role'] != null ? Role.fromJson(tempJson['role']) : null,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,14 +77,14 @@ class UserModel {
|
|||||||
'email': email,
|
'email': email,
|
||||||
'firstName': firstName,
|
'firstName': firstName,
|
||||||
'lastName': lastName,
|
'lastName': lastName,
|
||||||
'profilePicture': profilePicture != null ? base64.encode(profilePicture!) : null,
|
'profilePicture':
|
||||||
|
profilePicture != null ? base64.encode(profilePicture!) : null,
|
||||||
'phoneNumber': phoneNumber,
|
'phoneNumber': phoneNumber,
|
||||||
'isEmailVerified': isEmailVerified,
|
'isEmailVerified': isEmailVerified,
|
||||||
'regionUuid': regionUuid,
|
'regionUuid': regionUuid,
|
||||||
'isAgreementAccepted': isAgreementAccepted,
|
'isAgreementAccepted': isAgreementAccepted,
|
||||||
'regionName': regionName,
|
'regionName': regionName,
|
||||||
'timeZone': timeZone,
|
'timeZone': timeZone,
|
||||||
'role': role?.toJson(),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,7 @@ class JoinHomeView extends StatelessWidget {
|
|||||||
'Please enter the invitation code');
|
'Please enter the invitation code');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (await HomeCubit.getInstance()
|
if (await HomeCubit.getInstance().activationCode(textEditingController.text)) {
|
||||||
.activationCode(textEditingController.text)) {
|
|
||||||
await HomeCubit.getInstance().fetchUnitsByUserId();
|
await HomeCubit.getInstance().fetchUnitsByUserId();
|
||||||
|
|
||||||
CustomSnackBar.displaySnackBar('Done successfully');
|
CustomSnackBar.displaySnackBar('Done successfully');
|
||||||
|
Reference in New Issue
Block a user