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

@@ -63,7 +63,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
try {
final domain.ApiResponse startResponse = await _apiService.post(
AuthEndpoints.staffPhoneStart.path,
AuthEndpoints.staffPhoneStart,
data: <String, dynamic>{
'phoneNumber': phoneNumber,
},
@@ -182,7 +182,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
// Step 3: Call V2 verify endpoint with the Firebase ID token.
final String v2Mode = mode == AuthMode.signup ? 'sign-up' : 'sign-in';
final domain.ApiResponse response = await _apiService.post(
AuthEndpoints.staffPhoneVerify.path,
AuthEndpoints.staffPhoneVerify,
data: <String, dynamic>{
'idToken': idToken,
'mode': v2Mode,
@@ -233,7 +233,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
@override
Future<void> signOut() async {
try {
await _apiService.post(AuthEndpoints.staffSignOut.path);
await _apiService.post(AuthEndpoints.staffSignOut);
} catch (_) {
// Sign-out should not fail even if the API call fails.
// The local sign-out below will clear the session regardless.

View File

@@ -27,7 +27,7 @@ class ProfileSetupRepositoryImpl implements ProfileSetupRepository {
required List<String> skills,
}) async {
final ApiResponse response = await _apiService.post(
StaffEndpoints.profileSetup.path,
StaffEndpoints.profileSetup,
data: <String, dynamic>{
'fullName': fullName,
if (bio != null && bio.isNotEmpty) 'bio': bio,