restrict_spaceMemberUser_and_change_SignUpModel

This commit is contained in:
mohammad
2025-01-23 18:35:01 +03:00
parent 827585815b
commit 790479effb
20 changed files with 643 additions and 322 deletions

View File

@ -225,4 +225,7 @@ abstract class ApiEndpoints {
static const String getDeviceLogs = '/device/report-logs/{uuid}?code={code}';
static const String terms = '/terms';
static const String policy = '/policy';
static const String getPermission = '/permission/{roleUuid}';
///permission/roleUuid
}

View File

@ -88,7 +88,8 @@ class DevicesAPI {
static Future<Map<String, dynamic>> getDeviceStatus(String deviceId) async {
final response = await _httpService.get(
path: ApiEndpoints.deviceFunctionsStatus.replaceAll('{deviceUuid}', deviceId),
path: ApiEndpoints.deviceFunctionsStatus
.replaceAll('{deviceUuid}', deviceId),
showServerMessage: false,
expectedResponseModel: (json) {
return json;
@ -97,7 +98,8 @@ class DevicesAPI {
return response;
}
static Future<Map<String, dynamic>> getPowerClampStatus(String deviceId) async {
static Future<Map<String, dynamic>> getPowerClampStatus(
String deviceId) async {
final response = await _httpService.get(
path: ApiEndpoints.powerClamp.replaceAll('{powerClampUuid}', deviceId),
showServerMessage: false,
@ -109,7 +111,9 @@ class DevicesAPI {
}
static Future<Map<String, dynamic>> renamePass(
{required String name, required String doorLockUuid, required String passwordId}) async {
{required String name,
required String doorLockUuid,
required String passwordId}) async {
final response = await _httpService.put(
path: ApiEndpoints.renamePassword
.replaceAll('{doorLockUuid}', doorLockUuid)
@ -144,7 +148,8 @@ class DevicesAPI {
return response;
}
static Future getSceneBySwitchName({String? deviceId, String? switchName}) async {
static Future getSceneBySwitchName(
{String? deviceId, String? switchName}) async {
final response = await _httpService.get(
path: ApiEndpoints.fourSceneByName
.replaceAll('{deviceUuid}', deviceId!)
@ -165,7 +170,11 @@ class DevicesAPI {
final response = await _httpService.post(
path: ApiEndpoints.deviceScene.replaceAll('{deviceUuid}', deviceId!),
body: jsonEncode(
{"switchName": switchName, "sceneUuid": sceneUuid, "spaceUuid": spaceUuid},
{
"switchName": switchName,
"sceneUuid": sceneUuid,
"spaceUuid": spaceUuid
},
),
showServerMessage: false,
expectedResponseModel: (json) {
@ -185,7 +194,8 @@ class DevicesAPI {
return response;
}
static Future<List<DeviceModel>> getDeviceByGroupName(String unitId, String groupName) async {
static Future<List<DeviceModel>> getDeviceByGroupName(
String unitId, String groupName) async {
final response = await _httpService.get(
path: ApiEndpoints.devicesByGroupName
.replaceAll('{unitUuid}', unitId)
@ -230,7 +240,9 @@ class DevicesAPI {
if (json == null || json.isEmpty || json == []) {
return <DeviceModel>[];
}
return data.map<DeviceModel>((device) => DeviceModel.fromJson(device)).toList();
return data
.map<DeviceModel>((device) => DeviceModel.fromJson(device))
.toList();
},
);
@ -242,7 +254,8 @@ class DevicesAPI {
}
}
static Future<List<DeviceModel>> getDevicesByGatewayId(String gatewayId) async {
static Future<List<DeviceModel>> getDevicesByGatewayId(
String gatewayId) async {
final response = await _httpService.get(
path: ApiEndpoints.gatewayApi.replaceAll('{gatewayUuid}', gatewayId),
showServerMessage: false,
@ -264,7 +277,8 @@ class DevicesAPI {
String deviceId,
) async {
final response = await _httpService.get(
path: ApiEndpoints.getTemporaryPassword.replaceAll('{doorLockUuid}', deviceId),
path: ApiEndpoints.getTemporaryPassword
.replaceAll('{doorLockUuid}', deviceId),
showServerMessage: false,
expectedResponseModel: (json) {
return json;
@ -275,7 +289,8 @@ class DevicesAPI {
static Future getOneTimePasswords(String deviceId) async {
final response = await _httpService.get(
path: ApiEndpoints.getOneTimeTemporaryPassword.replaceAll('{doorLockUuid}', deviceId),
path: ApiEndpoints.getOneTimeTemporaryPassword
.replaceAll('{doorLockUuid}', deviceId),
showServerMessage: false,
expectedResponseModel: (json) {
return json;
@ -286,7 +301,8 @@ class DevicesAPI {
static Future getTimeLimitPasswords(String deviceId) async {
final response = await _httpService.get(
path: ApiEndpoints.getMultipleTimeTemporaryPassword.replaceAll('{doorLockUuid}', deviceId),
path: ApiEndpoints.getMultipleTimeTemporaryPassword
.replaceAll('{doorLockUuid}', deviceId),
showServerMessage: false,
expectedResponseModel: (json) {
return json;
@ -311,10 +327,12 @@ class DevicesAPI {
"invalidTime": invalidTime,
};
if (scheduleList != null) {
body["scheduleList"] = scheduleList.map((schedule) => schedule.toJson()).toList();
body["scheduleList"] =
scheduleList.map((schedule) => schedule.toJson()).toList();
}
final response = await _httpService.post(
path: ApiEndpoints.addTemporaryPassword.replaceAll('{doorLockUuid}', deviceId),
path: ApiEndpoints.addTemporaryPassword
.replaceAll('{doorLockUuid}', deviceId),
body: body,
showServerMessage: false,
expectedResponseModel: (json) => json,
@ -325,7 +343,8 @@ class DevicesAPI {
static Future generateOneTimePassword({deviceId}) async {
try {
final response = await _httpService.post(
path: ApiEndpoints.addOneTimeTemporaryPassword.replaceAll('{doorLockUuid}', deviceId),
path: ApiEndpoints.addOneTimeTemporaryPassword
.replaceAll('{doorLockUuid}', deviceId),
showServerMessage: false,
expectedResponseModel: (json) {
return json;
@ -337,10 +356,12 @@ class DevicesAPI {
}
}
static Future generateMultiTimePassword({deviceId, effectiveTime, invalidTime}) async {
static Future generateMultiTimePassword(
{deviceId, effectiveTime, invalidTime}) async {
try {
final response = await _httpService.post(
path: ApiEndpoints.addMultipleTimeTemporaryPassword.replaceAll('{doorLockUuid}', deviceId),
path: ApiEndpoints.addMultipleTimeTemporaryPassword
.replaceAll('{doorLockUuid}', deviceId),
showServerMessage: true,
body: {"effectiveTime": effectiveTime, "invalidTime": invalidTime},
expectedResponseModel: (json) {
@ -530,7 +551,9 @@ class DevicesAPI {
String code,
) async {
final response = await HTTPService().get(
path: ApiEndpoints.getDeviceLogs.replaceAll('{uuid}', uuid).replaceAll('{code}', code),
path: ApiEndpoints.getDeviceLogs
.replaceAll('{uuid}', uuid)
.replaceAll('{code}', code),
showServerMessage: false,
expectedResponseModel: (json) {
return DeviceReport.fromJson(json);

View File

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:developer';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/auth/model/user_model.dart';
import 'package:syncrow_app/features/menu/model/region_model.dart';
@ -95,6 +94,16 @@ class ProfileApi {
return response;
}
Future fetchPermissions(roleId) async {
final response = await _httpService.get(
path: ApiEndpoints.getPermission.replaceAll('{roleUuid}', roleId!),
showServerMessage: true,
expectedResponseModel: (json) {
return json;
});
return response;
}
static Future<List<RegionModel>> fetchRegion() async {
final response = await _httpService.get(
path: ApiEndpoints.getRegion,
@ -117,7 +126,7 @@ class ProfileApi {
return response as List<TimeZone>;
}
Future fetchUserAgreement() async {
Future fetchUserAgreement() async {
final response = await _httpService.get(
path: ApiEndpoints.terms,
showServerMessage: true,
@ -127,7 +136,7 @@ class ProfileApi {
return response;
}
Future fetchPrivacyPolicy() async {
Future fetchPrivacyPolicy() async {
final response = await _httpService.get(
path: ApiEndpoints.policy,
showServerMessage: true,