You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.4 KiB
2.4 KiB
View-Only Mode: CustomerID Parameter Exclusion
Summary
Updated all API calls to exclude customerID parameter when AppState().getIsViewOnly is true.
Files Modified
1. request_repo.dart
- ✅
createRequest()- Excludes customerID in view-only mode - ✅
getRequests()- Excludes customerID for customer app type in view-only mode - ✅
getRequestBasedOnFilters()- Excludes customerID for customer app type in view-only mode - ✅
getOffersFromProvidersByRequest()- Excludes customerID in view-only mode
2. ads_repo.dart
- ✅
cancelMyAdReservation()- Excludes customerID in view-only mode - ✅
createReserveAd()- Excludes customerID in view-only mode - ✅
uploadBankReceiptsOnReserveDealDone()- Excludes customerID in view-only mode
3. appointment_repo.dart
- ✅
createAppointmentsMulti()- Excludes customerID in view-only mode - ✅
getMyAppointmentsForCustomersByFilters()- Excludes customerID in view-only mode
4. branch_repo.dart
- ✅
submitBranchRatings()- Excludes customerID in view-only mode - ✅
addProviderToFavourite()- Excludes customerID in view-only mode - ✅
getMyFavoriteProviders()- Excludes customerID in view-only mode
5. setting_options_repo.dart
- ✅
appInvitationCreate()- Excludes customerID for customer app type in view-only mode
How It Works
When AppState().getIsViewOnly is true, the application is in demonstration/view-only mode. In this mode:
-
API parameters are conditionally added: Instead of always including
customerID, we check the view-only flag first -
Pattern used:
var params = { "otherParam": value, }; if (!appState.getIsViewOnly) { params["customerID"] = customerId; } -
App types considered: The changes properly handle both customer and provider app types
Testing Recommendations
-
Test in normal mode (getIsViewOnly = false):
- All APIs should include customerID as before
- All existing functionality should work
-
Test in view-only mode (getIsViewOnly = true):
- APIs should NOT include customerID parameter
- Read-only operations should work
- Write operations should be blocked by view-only mode
Note
The createComplainFromProvider() method in common_repo.dart was NOT modified because the customerID in that API represents the target customer being complained about, not the authenticated user making the request.