mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-16 10:06:19 +00:00
formatted all files.
This commit is contained in:
@ -23,18 +23,18 @@ class UserPermissionApi {
|
||||
},
|
||||
);
|
||||
return response;
|
||||
} catch (e, stackTrace) {
|
||||
} catch (e) {
|
||||
debugPrint('Error in fetchUsers: $e');
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
fetchRoles() async {
|
||||
Future<List<RoleTypeModel>> fetchRoles() async {
|
||||
final response = await _httpService.get(
|
||||
path: ApiEndpoints.roleTypes,
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
final List<RoleTypeModel> fetchedRoles = (json['data'] as List)
|
||||
final fetchedRoles = (json['data'] as List)
|
||||
.map((item) => RoleTypeModel.fromJson(item))
|
||||
.toList();
|
||||
return fetchedRoles;
|
||||
@ -45,7 +45,7 @@ class UserPermissionApi {
|
||||
|
||||
Future<List<PermissionOption>> fetchPermission(roleUuid) async {
|
||||
final response = await _httpService.get(
|
||||
path: ApiEndpoints.permission.replaceAll("roleUuid", roleUuid),
|
||||
path: ApiEndpoints.permission.replaceAll('roleUuid', roleUuid),
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
return (json as List)
|
||||
@ -68,14 +68,14 @@ class UserPermissionApi {
|
||||
}) async {
|
||||
try {
|
||||
final body = <String, dynamic>{
|
||||
"firstName": firstName,
|
||||
"lastName": lastName,
|
||||
"email": email,
|
||||
"jobTitle": jobTitle != '' ? jobTitle : null,
|
||||
"phoneNumber": phoneNumber != '' ? phoneNumber : null,
|
||||
"roleUuid": roleUuid,
|
||||
"projectUuid": projectUuid,
|
||||
"spaceUuids": spaceUuids,
|
||||
'firstName': firstName,
|
||||
'lastName': lastName,
|
||||
'email': email,
|
||||
'jobTitle': jobTitle != '' ? jobTitle : null,
|
||||
'phoneNumber': phoneNumber != '' ? phoneNumber : null,
|
||||
'roleUuid': roleUuid,
|
||||
'projectUuid': projectUuid,
|
||||
'spaceUuids': spaceUuids,
|
||||
};
|
||||
final response = await _httpService.post(
|
||||
path: ApiEndpoints.inviteUser,
|
||||
@ -83,7 +83,7 @@ class UserPermissionApi {
|
||||
body: jsonEncode(body),
|
||||
expectedResponseModel: (json) {
|
||||
if (json['statusCode'] != 400) {
|
||||
return json["success"];
|
||||
return json['success'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@ -91,7 +91,7 @@ class UserPermissionApi {
|
||||
);
|
||||
|
||||
return response ?? [];
|
||||
} on DioException catch (e) {
|
||||
} on DioException {
|
||||
return false;
|
||||
} catch (e) {
|
||||
return false;
|
||||
@ -103,10 +103,10 @@ class UserPermissionApi {
|
||||
final response = await _httpService.post(
|
||||
path: ApiEndpoints.checkEmail,
|
||||
showServerMessage: true,
|
||||
body: {"email": email},
|
||||
body: {'email': email},
|
||||
expectedResponseModel: (json) {
|
||||
if (json['statusCode'] != 400) {
|
||||
var message = json["message"];
|
||||
final message = json['message'];
|
||||
if (message is String) {
|
||||
return message;
|
||||
} else {
|
||||
@ -128,11 +128,11 @@ class UserPermissionApi {
|
||||
Future<EditUserModel?> fetchUserById(userUuid, String projectId) async {
|
||||
final response = await _httpService.get(
|
||||
path: ApiEndpoints.getUserById
|
||||
.replaceAll("{userUuid}", userUuid)
|
||||
.replaceAll("{projectId}", projectId),
|
||||
.replaceAll('{userUuid}', userUuid)
|
||||
.replaceAll('{projectId}', projectId),
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
EditUserModel res = EditUserModel.fromJson(json['data']);
|
||||
final res = EditUserModel.fromJson(json['data']);
|
||||
return res;
|
||||
},
|
||||
);
|
||||
@ -151,27 +151,27 @@ class UserPermissionApi {
|
||||
}) async {
|
||||
try {
|
||||
final body = <String, dynamic>{
|
||||
"firstName": firstName,
|
||||
"lastName": lastName,
|
||||
"jobTitle": jobTitle != '' ? jobTitle : " ",
|
||||
"phoneNumber": phoneNumber != '' ? phoneNumber : " ",
|
||||
"roleUuid": roleUuid,
|
||||
"projectUuid": projectUuid,
|
||||
"spaceUuids": spaceUuids,
|
||||
'firstName': firstName,
|
||||
'lastName': lastName,
|
||||
'jobTitle': jobTitle != '' ? jobTitle : ' ',
|
||||
'phoneNumber': phoneNumber != '' ? phoneNumber : ' ',
|
||||
'roleUuid': roleUuid,
|
||||
'projectUuid': projectUuid,
|
||||
'spaceUuids': spaceUuids,
|
||||
};
|
||||
final response = await _httpService.put(
|
||||
path: ApiEndpoints.editUser.replaceAll('{inviteUserUuid}', userId!),
|
||||
body: jsonEncode(body),
|
||||
expectedResponseModel: (json) {
|
||||
if (json['statusCode'] != 400) {
|
||||
return json["success"];
|
||||
return json['success'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
);
|
||||
return response;
|
||||
} on DioException catch (e) {
|
||||
} on DioException {
|
||||
return false;
|
||||
} catch (e) {
|
||||
return false;
|
||||
@ -181,7 +181,7 @@ class UserPermissionApi {
|
||||
Future<bool> deleteUserById(userUuid) async {
|
||||
try {
|
||||
final response = await _httpService.delete(
|
||||
path: ApiEndpoints.deleteUser.replaceAll("{inviteUserUuid}", userUuid),
|
||||
path: ApiEndpoints.deleteUser.replaceAll('{inviteUserUuid}', userUuid),
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
return json['success'];
|
||||
@ -193,16 +193,17 @@ class UserPermissionApi {
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> changeUserStatusById(userUuid, status, String projectUuid) async {
|
||||
Future<bool> changeUserStatusById(
|
||||
userUuid, status, String projectUuid) async {
|
||||
try {
|
||||
Map<String, dynamic> bodya = {
|
||||
"disable": status,
|
||||
"projectUuid": projectUuid
|
||||
final bodya = <String, dynamic>{
|
||||
'disable': status,
|
||||
'projectUuid': projectUuid
|
||||
};
|
||||
|
||||
final response = await _httpService.put(
|
||||
path: ApiEndpoints.changeUserStatus
|
||||
.replaceAll("{invitedUserUuid}", userUuid),
|
||||
.replaceAll('{invitedUserUuid}', userUuid),
|
||||
body: bodya,
|
||||
expectedResponseModel: (json) {
|
||||
return json['success'];
|
||||
|
Reference in New Issue
Block a user