feat: Update API endpoint usage in repositories to remove redundant path property

- Refactored multiple repository implementations across client and staff features to directly use endpoint objects without accessing the `path` property.
- Introduced a new `FeatureGate` class for client-side feature gating based on user scopes, allowing for better access control to API endpoints.
- Added `ApiEndpoint` class to represent API endpoints with their paths and required scopes for future feature gating.
This commit is contained in:
Achintha Isuru
2026-03-17 12:01:06 -04:00
parent 57bba8ab4e
commit 376b4e4431
47 changed files with 240 additions and 139 deletions

View File

@@ -24,7 +24,7 @@ class PaymentsRepositoryImpl implements PaymentsRepository {
if (endDate != null) 'endDate': endDate,
};
final ApiResponse response = await _apiService.get(
StaffEndpoints.paymentsSummary.path,
StaffEndpoints.paymentsSummary,
params: params.isEmpty ? null : params,
);
return PaymentSummary.fromJson(response.data as Map<String, dynamic>);
@@ -40,7 +40,7 @@ class PaymentsRepositoryImpl implements PaymentsRepository {
if (endDate != null) 'endDate': endDate,
};
final ApiResponse response = await _apiService.get(
StaffEndpoints.paymentsHistory.path,
StaffEndpoints.paymentsHistory,
params: params.isEmpty ? null : params,
);
final Map<String, dynamic> body = response.data as Map<String, dynamic>;
@@ -63,7 +63,7 @@ class PaymentsRepositoryImpl implements PaymentsRepository {
if (endDate != null) 'endDate': endDate,
};
final ApiResponse response = await _apiService.get(
StaffEndpoints.paymentsChart.path,
StaffEndpoints.paymentsChart,
params: params,
);
final Map<String, dynamic> body = response.data as Map<String, dynamic>;