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:
@@ -45,7 +45,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
|
||||
// Step 1: Call V2 sign-in endpoint — server handles Firebase Auth
|
||||
// via Identity Toolkit and returns a full auth envelope.
|
||||
final ApiResponse response = await _apiService.post(
|
||||
AuthEndpoints.clientSignIn.path,
|
||||
AuthEndpoints.clientSignIn,
|
||||
data: <String, dynamic>{
|
||||
'email': email,
|
||||
'password': password,
|
||||
@@ -107,7 +107,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
|
||||
// - Creates user, tenant, business, memberships in one transaction
|
||||
// - Returns full auth envelope with session tokens
|
||||
final ApiResponse response = await _apiService.post(
|
||||
AuthEndpoints.clientSignUp.path,
|
||||
AuthEndpoints.clientSignUp,
|
||||
data: <String, dynamic>{
|
||||
'companyName': companyName,
|
||||
'email': email,
|
||||
@@ -172,7 +172,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
|
||||
Future<void> signOut() async {
|
||||
try {
|
||||
// Step 1: Call V2 sign-out endpoint for server-side token revocation.
|
||||
await _apiService.post(AuthEndpoints.clientSignOut.path);
|
||||
await _apiService.post(AuthEndpoints.clientSignOut);
|
||||
} catch (e) {
|
||||
developer.log(
|
||||
'V2 sign-out request failed: $e',
|
||||
|
||||
@@ -17,7 +17,7 @@ class BillingRepositoryImpl implements BillingRepository {
|
||||
@override
|
||||
Future<List<BillingAccount>> getBankAccounts() async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(ClientEndpoints.billingAccounts.path);
|
||||
await _apiService.get(ClientEndpoints.billingAccounts);
|
||||
final List<dynamic> items =
|
||||
(response.data as Map<String, dynamic>)['items'] as List<dynamic>;
|
||||
return items
|
||||
@@ -29,7 +29,7 @@ class BillingRepositoryImpl implements BillingRepository {
|
||||
@override
|
||||
Future<List<Invoice>> getPendingInvoices() async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(ClientEndpoints.billingInvoicesPending.path);
|
||||
await _apiService.get(ClientEndpoints.billingInvoicesPending);
|
||||
final List<dynamic> items =
|
||||
(response.data as Map<String, dynamic>)['items'] as List<dynamic>;
|
||||
return items
|
||||
@@ -41,7 +41,7 @@ class BillingRepositoryImpl implements BillingRepository {
|
||||
@override
|
||||
Future<List<Invoice>> getInvoiceHistory() async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(ClientEndpoints.billingInvoicesHistory.path);
|
||||
await _apiService.get(ClientEndpoints.billingInvoicesHistory);
|
||||
final List<dynamic> items =
|
||||
(response.data as Map<String, dynamic>)['items'] as List<dynamic>;
|
||||
return items
|
||||
@@ -53,7 +53,7 @@ class BillingRepositoryImpl implements BillingRepository {
|
||||
@override
|
||||
Future<int> getCurrentBillCents() async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(ClientEndpoints.billingCurrentBill.path);
|
||||
await _apiService.get(ClientEndpoints.billingCurrentBill);
|
||||
final Map<String, dynamic> data =
|
||||
response.data as Map<String, dynamic>;
|
||||
return (data['currentBillCents'] as num).toInt();
|
||||
@@ -62,7 +62,7 @@ class BillingRepositoryImpl implements BillingRepository {
|
||||
@override
|
||||
Future<int> getSavingsCents() async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(ClientEndpoints.billingSavings.path);
|
||||
await _apiService.get(ClientEndpoints.billingSavings);
|
||||
final Map<String, dynamic> data =
|
||||
response.data as Map<String, dynamic>;
|
||||
return (data['savingsCents'] as num).toInt();
|
||||
@@ -74,7 +74,7 @@ class BillingRepositoryImpl implements BillingRepository {
|
||||
required String endDate,
|
||||
}) async {
|
||||
final ApiResponse response = await _apiService.get(
|
||||
ClientEndpoints.billingSpendBreakdown.path,
|
||||
ClientEndpoints.billingSpendBreakdown,
|
||||
params: <String, dynamic>{
|
||||
'startDate': startDate,
|
||||
'endDate': endDate,
|
||||
@@ -90,13 +90,13 @@ class BillingRepositoryImpl implements BillingRepository {
|
||||
|
||||
@override
|
||||
Future<void> approveInvoice(String id) async {
|
||||
await _apiService.post(ClientEndpoints.invoiceApprove(id).path);
|
||||
await _apiService.post(ClientEndpoints.invoiceApprove(id));
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> disputeInvoice(String id, String reason) async {
|
||||
await _apiService.post(
|
||||
ClientEndpoints.invoiceDispute(id).path,
|
||||
ClientEndpoints.invoiceDispute(id),
|
||||
data: <String, dynamic>{'reason': reason},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class CoverageRepositoryImpl implements CoverageRepository {
|
||||
final String dateStr =
|
||||
'${date.year}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}';
|
||||
final ApiResponse response = await _apiService.get(
|
||||
ClientEndpoints.coverage.path,
|
||||
ClientEndpoints.coverage,
|
||||
params: <String, dynamic>{'date': dateStr},
|
||||
);
|
||||
final List<dynamic> items = response.data['items'] as List<dynamic>;
|
||||
@@ -35,7 +35,7 @@ class CoverageRepositoryImpl implements CoverageRepository {
|
||||
final String dateStr =
|
||||
'${date.year}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}';
|
||||
final ApiResponse response = await _apiService.get(
|
||||
ClientEndpoints.coverageStats.path,
|
||||
ClientEndpoints.coverageStats,
|
||||
params: <String, dynamic>{'date': dateStr},
|
||||
);
|
||||
return CoverageStats.fromJson(response.data as Map<String, dynamic>);
|
||||
@@ -67,7 +67,7 @@ class CoverageRepositoryImpl implements CoverageRepository {
|
||||
body['markAsFavorite'] = markAsFavorite;
|
||||
}
|
||||
await _apiService.post(
|
||||
ClientEndpoints.coverageReviews.path,
|
||||
ClientEndpoints.coverageReviews,
|
||||
data: body,
|
||||
);
|
||||
}
|
||||
@@ -82,7 +82,7 @@ class CoverageRepositoryImpl implements CoverageRepository {
|
||||
body['reason'] = reason;
|
||||
}
|
||||
await _apiService.post(
|
||||
ClientEndpoints.coverageCancelLateWorker(assignmentId).path,
|
||||
ClientEndpoints.coverageCancelLateWorker(assignmentId),
|
||||
data: body,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ class HomeRepositoryImpl implements HomeRepositoryInterface {
|
||||
@override
|
||||
Future<ClientDashboard> getDashboard() async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(ClientEndpoints.dashboard.path);
|
||||
await _apiService.get(ClientEndpoints.dashboard);
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
return ClientDashboard.fromJson(data);
|
||||
}
|
||||
@@ -26,7 +26,7 @@ class HomeRepositoryImpl implements HomeRepositoryInterface {
|
||||
@override
|
||||
Future<List<RecentOrder>> getRecentReorders() async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(ClientEndpoints.reorders.path);
|
||||
await _apiService.get(ClientEndpoints.reorders);
|
||||
final Map<String, dynamic> body = response.data as Map<String, dynamic>;
|
||||
final List<dynamic> items = body['items'] as List<dynamic>;
|
||||
return items
|
||||
|
||||
@@ -17,7 +17,7 @@ class HubRepositoryImpl implements HubRepositoryInterface {
|
||||
@override
|
||||
Future<List<Hub>> getHubs() async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(ClientEndpoints.hubs.path);
|
||||
await _apiService.get(ClientEndpoints.hubs);
|
||||
final List<dynamic> items =
|
||||
(response.data as Map<String, dynamic>)['items'] as List<dynamic>;
|
||||
return items
|
||||
@@ -28,7 +28,7 @@ class HubRepositoryImpl implements HubRepositoryInterface {
|
||||
@override
|
||||
Future<List<CostCenter>> getCostCenters() async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(ClientEndpoints.costCenters.path);
|
||||
await _apiService.get(ClientEndpoints.costCenters);
|
||||
final List<dynamic> items =
|
||||
(response.data as Map<String, dynamic>)['items'] as List<dynamic>;
|
||||
return items
|
||||
@@ -52,7 +52,7 @@ class HubRepositoryImpl implements HubRepositoryInterface {
|
||||
String? costCenterId,
|
||||
}) async {
|
||||
final ApiResponse response = await _apiService.post(
|
||||
ClientEndpoints.hubCreate.path,
|
||||
ClientEndpoints.hubCreate,
|
||||
data: <String, dynamic>{
|
||||
'name': name,
|
||||
'fullAddress': fullAddress,
|
||||
@@ -88,7 +88,7 @@ class HubRepositoryImpl implements HubRepositoryInterface {
|
||||
String? costCenterId,
|
||||
}) async {
|
||||
final ApiResponse response = await _apiService.put(
|
||||
ClientEndpoints.hubUpdate(hubId).path,
|
||||
ClientEndpoints.hubUpdate(hubId),
|
||||
data: <String, dynamic>{
|
||||
'hubId': hubId,
|
||||
if (name != null) 'name': name,
|
||||
@@ -111,7 +111,7 @@ class HubRepositoryImpl implements HubRepositoryInterface {
|
||||
|
||||
@override
|
||||
Future<void> deleteHub(String hubId) async {
|
||||
await _apiService.delete(ClientEndpoints.hubDelete(hubId).path);
|
||||
await _apiService.delete(ClientEndpoints.hubDelete(hubId));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -120,7 +120,7 @@ class HubRepositoryImpl implements HubRepositoryInterface {
|
||||
required String nfcTagId,
|
||||
}) async {
|
||||
await _apiService.post(
|
||||
ClientEndpoints.hubAssignNfc(hubId).path,
|
||||
ClientEndpoints.hubAssignNfc(hubId),
|
||||
data: <String, dynamic>{'nfcTagId': nfcTagId},
|
||||
);
|
||||
}
|
||||
@@ -128,7 +128,7 @@ class HubRepositoryImpl implements HubRepositoryInterface {
|
||||
@override
|
||||
Future<List<HubManager>> getManagers(String hubId) async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(ClientEndpoints.hubManagers(hubId).path);
|
||||
await _apiService.get(ClientEndpoints.hubManagers(hubId));
|
||||
final List<dynamic> items =
|
||||
(response.data as Map<String, dynamic>)['items'] as List<dynamic>;
|
||||
return items
|
||||
@@ -143,7 +143,7 @@ class HubRepositoryImpl implements HubRepositoryInterface {
|
||||
required List<String> businessMembershipIds,
|
||||
}) async {
|
||||
await _apiService.post(
|
||||
ClientEndpoints.hubAssignManagers(hubId).path,
|
||||
ClientEndpoints.hubAssignManagers(hubId),
|
||||
data: <String, dynamic>{
|
||||
'businessMembershipIds': businessMembershipIds,
|
||||
},
|
||||
|
||||
@@ -24,17 +24,17 @@ class ClientCreateOrderRepositoryImpl
|
||||
|
||||
@override
|
||||
Future<void> createOneTimeOrder(Map<String, dynamic> payload) async {
|
||||
await _api.post(ClientEndpoints.ordersOneTime.path, data: payload);
|
||||
await _api.post(ClientEndpoints.ordersOneTime, data: payload);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> createRecurringOrder(Map<String, dynamic> payload) async {
|
||||
await _api.post(ClientEndpoints.ordersRecurring.path, data: payload);
|
||||
await _api.post(ClientEndpoints.ordersRecurring, data: payload);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> createPermanentOrder(Map<String, dynamic> payload) async {
|
||||
await _api.post(ClientEndpoints.ordersPermanent.path, data: payload);
|
||||
await _api.post(ClientEndpoints.ordersPermanent, data: payload);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -82,7 +82,7 @@ class ClientCreateOrderRepositoryImpl
|
||||
@override
|
||||
Future<OrderPreview> getOrderDetailsForReorder(String orderId) async {
|
||||
final ApiResponse response = await _api.get(
|
||||
ClientEndpoints.orderReorderPreview(orderId).path,
|
||||
ClientEndpoints.orderReorderPreview(orderId),
|
||||
);
|
||||
return OrderPreview.fromJson(response.data as Map<String, dynamic>);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class ClientOrderQueryRepositoryImpl
|
||||
|
||||
@override
|
||||
Future<List<Vendor>> getVendors() async {
|
||||
final ApiResponse response = await _api.get(ClientEndpoints.vendors.path);
|
||||
final ApiResponse response = await _api.get(ClientEndpoints.vendors);
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
final List<dynamic> items = data['items'] as List<dynamic>;
|
||||
return items
|
||||
@@ -30,7 +30,7 @@ class ClientOrderQueryRepositoryImpl
|
||||
@override
|
||||
Future<List<OrderRole>> getRolesByVendor(String vendorId) async {
|
||||
final ApiResponse response =
|
||||
await _api.get(ClientEndpoints.vendorRoles(vendorId).path);
|
||||
await _api.get(ClientEndpoints.vendorRoles(vendorId));
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
final List<dynamic> items = data['items'] as List<dynamic>;
|
||||
return items.map((dynamic json) {
|
||||
@@ -46,7 +46,7 @@ class ClientOrderQueryRepositoryImpl
|
||||
|
||||
@override
|
||||
Future<List<OrderHub>> getHubs() async {
|
||||
final ApiResponse response = await _api.get(ClientEndpoints.hubs.path);
|
||||
final ApiResponse response = await _api.get(ClientEndpoints.hubs);
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
final List<dynamic> items = data['items'] as List<dynamic>;
|
||||
return items.map((dynamic json) {
|
||||
@@ -71,7 +71,7 @@ class ClientOrderQueryRepositoryImpl
|
||||
@override
|
||||
Future<List<OrderManager>> getManagersByHub(String hubId) async {
|
||||
final ApiResponse response =
|
||||
await _api.get(ClientEndpoints.hubManagers(hubId).path);
|
||||
await _api.get(ClientEndpoints.hubManagers(hubId));
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
final List<dynamic> items = data['items'] as List<dynamic>;
|
||||
return items.map((dynamic json) {
|
||||
|
||||
@@ -20,7 +20,7 @@ class ViewOrdersRepositoryImpl implements IViewOrdersRepository {
|
||||
required DateTime end,
|
||||
}) async {
|
||||
final ApiResponse response = await _api.get(
|
||||
ClientEndpoints.ordersView.path,
|
||||
ClientEndpoints.ordersView,
|
||||
params: <String, dynamic>{
|
||||
'startDate': start.toIso8601String(),
|
||||
'endDate': end.toIso8601String(),
|
||||
@@ -40,7 +40,7 @@ class ViewOrdersRepositoryImpl implements IViewOrdersRepository {
|
||||
required Map<String, dynamic> payload,
|
||||
}) async {
|
||||
final ApiResponse response = await _api.post(
|
||||
ClientEndpoints.orderEdit(orderId).path,
|
||||
ClientEndpoints.orderEdit(orderId),
|
||||
data: payload,
|
||||
);
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
@@ -53,7 +53,7 @@ class ViewOrdersRepositoryImpl implements IViewOrdersRepository {
|
||||
String? reason,
|
||||
}) async {
|
||||
await _api.post(
|
||||
ClientEndpoints.orderCancel(orderId).path,
|
||||
ClientEndpoints.orderCancel(orderId),
|
||||
data: <String, dynamic>{
|
||||
if (reason != null) 'reason': reason,
|
||||
},
|
||||
@@ -62,7 +62,7 @@ class ViewOrdersRepositoryImpl implements IViewOrdersRepository {
|
||||
|
||||
@override
|
||||
Future<List<Vendor>> getVendors() async {
|
||||
final ApiResponse response = await _api.get(ClientEndpoints.vendors.path);
|
||||
final ApiResponse response = await _api.get(ClientEndpoints.vendors);
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
final List<dynamic> items = data['items'] as List<dynamic>;
|
||||
return items
|
||||
@@ -73,7 +73,7 @@ class ViewOrdersRepositoryImpl implements IViewOrdersRepository {
|
||||
@override
|
||||
Future<List<Map<String, dynamic>>> getRolesByVendor(String vendorId) async {
|
||||
final ApiResponse response =
|
||||
await _api.get(ClientEndpoints.vendorRoles(vendorId).path);
|
||||
await _api.get(ClientEndpoints.vendorRoles(vendorId));
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
final List<dynamic> items = data['items'] as List<dynamic>;
|
||||
return items.cast<Map<String, dynamic>>();
|
||||
@@ -81,7 +81,7 @@ class ViewOrdersRepositoryImpl implements IViewOrdersRepository {
|
||||
|
||||
@override
|
||||
Future<List<Map<String, dynamic>>> getHubs() async {
|
||||
final ApiResponse response = await _api.get(ClientEndpoints.hubs.path);
|
||||
final ApiResponse response = await _api.get(ClientEndpoints.hubs);
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
final List<dynamic> items = data['items'] as List<dynamic>;
|
||||
return items.cast<Map<String, dynamic>>();
|
||||
@@ -90,7 +90,7 @@ class ViewOrdersRepositoryImpl implements IViewOrdersRepository {
|
||||
@override
|
||||
Future<List<Map<String, dynamic>>> getManagersByHub(String hubId) async {
|
||||
final ApiResponse response =
|
||||
await _api.get(ClientEndpoints.hubManagers(hubId).path);
|
||||
await _api.get(ClientEndpoints.hubManagers(hubId));
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
final List<dynamic> items = data['items'] as List<dynamic>;
|
||||
return items.cast<Map<String, dynamic>>();
|
||||
|
||||
@@ -32,7 +32,7 @@ class ReportsRepositoryImpl implements ReportsRepository {
|
||||
required DateTime date,
|
||||
}) async {
|
||||
final ApiResponse response = await _apiService.get(
|
||||
ClientEndpoints.reportsDailyOps.path,
|
||||
ClientEndpoints.reportsDailyOps,
|
||||
params: <String, dynamic>{'date': _iso(date)},
|
||||
);
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
@@ -45,7 +45,7 @@ class ReportsRepositoryImpl implements ReportsRepository {
|
||||
required DateTime endDate,
|
||||
}) async {
|
||||
final ApiResponse response = await _apiService.get(
|
||||
ClientEndpoints.reportsSpend.path,
|
||||
ClientEndpoints.reportsSpend,
|
||||
params: _rangeParams(startDate, endDate),
|
||||
);
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
@@ -58,7 +58,7 @@ class ReportsRepositoryImpl implements ReportsRepository {
|
||||
required DateTime endDate,
|
||||
}) async {
|
||||
final ApiResponse response = await _apiService.get(
|
||||
ClientEndpoints.reportsCoverage.path,
|
||||
ClientEndpoints.reportsCoverage,
|
||||
params: _rangeParams(startDate, endDate),
|
||||
);
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
@@ -71,7 +71,7 @@ class ReportsRepositoryImpl implements ReportsRepository {
|
||||
required DateTime endDate,
|
||||
}) async {
|
||||
final ApiResponse response = await _apiService.get(
|
||||
ClientEndpoints.reportsForecast.path,
|
||||
ClientEndpoints.reportsForecast,
|
||||
params: _rangeParams(startDate, endDate),
|
||||
);
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
@@ -84,7 +84,7 @@ class ReportsRepositoryImpl implements ReportsRepository {
|
||||
required DateTime endDate,
|
||||
}) async {
|
||||
final ApiResponse response = await _apiService.get(
|
||||
ClientEndpoints.reportsPerformance.path,
|
||||
ClientEndpoints.reportsPerformance,
|
||||
params: _rangeParams(startDate, endDate),
|
||||
);
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
@@ -97,7 +97,7 @@ class ReportsRepositoryImpl implements ReportsRepository {
|
||||
required DateTime endDate,
|
||||
}) async {
|
||||
final ApiResponse response = await _apiService.get(
|
||||
ClientEndpoints.reportsNoShow.path,
|
||||
ClientEndpoints.reportsNoShow,
|
||||
params: _rangeParams(startDate, endDate),
|
||||
);
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
@@ -110,7 +110,7 @@ class ReportsRepositoryImpl implements ReportsRepository {
|
||||
required DateTime endDate,
|
||||
}) async {
|
||||
final ApiResponse response = await _apiService.get(
|
||||
ClientEndpoints.reportsSummary.path,
|
||||
ClientEndpoints.reportsSummary,
|
||||
params: _rangeParams(startDate, endDate),
|
||||
);
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
|
||||
@@ -22,7 +22,7 @@ class SettingsRepositoryImpl implements SettingsRepositoryInterface {
|
||||
Future<void> signOut() async {
|
||||
try {
|
||||
// Step 1: Call V2 sign-out endpoint for server-side token revocation.
|
||||
await _apiService.post(AuthEndpoints.clientSignOut.path);
|
||||
await _apiService.post(AuthEndpoints.clientSignOut);
|
||||
} catch (e) {
|
||||
developer.log(
|
||||
'V2 sign-out request failed: $e',
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -25,7 +25,7 @@ class AvailabilityRepositoryImpl implements AvailabilityRepository {
|
||||
final String endDate = _toIsoDate(end);
|
||||
|
||||
final ApiResponse response = await _apiService.get(
|
||||
StaffEndpoints.availability.path,
|
||||
StaffEndpoints.availability,
|
||||
params: <String, dynamic>{
|
||||
'startDate': startDate,
|
||||
'endDate': endDate,
|
||||
@@ -48,7 +48,7 @@ class AvailabilityRepositoryImpl implements AvailabilityRepository {
|
||||
required List<TimeSlot> slots,
|
||||
}) async {
|
||||
final ApiResponse response = await _apiService.put(
|
||||
StaffEndpoints.availability.path,
|
||||
StaffEndpoints.availability,
|
||||
data: <String, dynamic>{
|
||||
'dayOfWeek': dayOfWeek,
|
||||
'availabilityStatus': status.toJson(),
|
||||
@@ -86,7 +86,7 @@ class AvailabilityRepositoryImpl implements AvailabilityRepository {
|
||||
}
|
||||
|
||||
await _apiService.post(
|
||||
StaffEndpoints.availabilityQuickSet.path,
|
||||
StaffEndpoints.availabilityQuickSet,
|
||||
data: data,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ class ClockInRepositoryImpl implements ClockInRepositoryInterface {
|
||||
@override
|
||||
Future<List<Shift>> getTodaysShifts() async {
|
||||
final ApiResponse response = await _apiService.get(
|
||||
StaffEndpoints.clockInShiftsToday.path,
|
||||
StaffEndpoints.clockInShiftsToday,
|
||||
);
|
||||
final List<dynamic> items = response.data['items'] as List<dynamic>;
|
||||
// TODO: Ask BE to add latitude, longitude, hourlyRate, and clientName
|
||||
@@ -33,7 +33,7 @@ class ClockInRepositoryImpl implements ClockInRepositoryInterface {
|
||||
@override
|
||||
Future<AttendanceStatus> getAttendanceStatus() async {
|
||||
final ApiResponse response = await _apiService.get(
|
||||
StaffEndpoints.clockInStatus.path,
|
||||
StaffEndpoints.clockInStatus,
|
||||
);
|
||||
return AttendanceStatus.fromJson(response.data as Map<String, dynamic>);
|
||||
}
|
||||
@@ -44,7 +44,7 @@ class ClockInRepositoryImpl implements ClockInRepositoryInterface {
|
||||
String? notes,
|
||||
}) async {
|
||||
await _apiService.post(
|
||||
StaffEndpoints.clockIn.path,
|
||||
StaffEndpoints.clockIn,
|
||||
data: <String, dynamic>{
|
||||
'shiftId': shiftId,
|
||||
'sourceType': 'GEO',
|
||||
@@ -62,7 +62,7 @@ class ClockInRepositoryImpl implements ClockInRepositoryInterface {
|
||||
String? shiftId,
|
||||
}) async {
|
||||
await _apiService.post(
|
||||
StaffEndpoints.clockOut.path,
|
||||
StaffEndpoints.clockOut,
|
||||
data: <String, dynamic>{
|
||||
if (shiftId != null) 'shiftId': shiftId,
|
||||
'sourceType': 'GEO',
|
||||
|
||||
@@ -17,7 +17,7 @@ class HomeRepositoryImpl implements HomeRepository {
|
||||
@override
|
||||
Future<StaffDashboard> getDashboard() async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(StaffEndpoints.dashboard.path);
|
||||
await _apiService.get(StaffEndpoints.dashboard);
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
return StaffDashboard.fromJson(data);
|
||||
}
|
||||
@@ -25,7 +25,7 @@ class HomeRepositoryImpl implements HomeRepository {
|
||||
@override
|
||||
Future<bool> getProfileCompletion() async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(StaffEndpoints.profileCompletion.path);
|
||||
await _apiService.get(StaffEndpoints.profileCompletion);
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
final ProfileCompletion completion = ProfileCompletion.fromJson(data);
|
||||
return completion.completed;
|
||||
|
||||
@@ -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>;
|
||||
|
||||
@@ -14,7 +14,7 @@ class ProfileRepositoryImpl {
|
||||
/// Fetches the staff profile from the V2 session endpoint.
|
||||
Future<Staff> getStaffProfile() async {
|
||||
final ApiResponse response =
|
||||
await _api.get(StaffEndpoints.session.path);
|
||||
await _api.get(StaffEndpoints.session);
|
||||
final Map<String, dynamic> json =
|
||||
response.data['staff'] as Map<String, dynamic>;
|
||||
return Staff.fromJson(json);
|
||||
@@ -23,7 +23,7 @@ class ProfileRepositoryImpl {
|
||||
/// Fetches the profile section completion statuses.
|
||||
Future<ProfileSectionStatus> getProfileSections() async {
|
||||
final ApiResponse response =
|
||||
await _api.get(StaffEndpoints.profileSections.path);
|
||||
await _api.get(StaffEndpoints.profileSections);
|
||||
final Map<String, dynamic> json =
|
||||
response.data as Map<String, dynamic>;
|
||||
return ProfileSectionStatus.fromJson(json);
|
||||
@@ -31,6 +31,6 @@ class ProfileRepositoryImpl {
|
||||
|
||||
/// Signs out the current user.
|
||||
Future<void> signOut() async {
|
||||
await _api.post(AuthEndpoints.signOut.path);
|
||||
await _api.post(AuthEndpoints.signOut);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class CertificatesRepositoryImpl implements CertificatesRepository {
|
||||
@override
|
||||
Future<List<StaffCertificate>> getCertificates() async {
|
||||
final ApiResponse response =
|
||||
await _api.get(StaffEndpoints.certificates.path);
|
||||
await _api.get(StaffEndpoints.certificates);
|
||||
final List<dynamic> items =
|
||||
response.data['certificates'] as List<dynamic>;
|
||||
return items
|
||||
@@ -73,7 +73,7 @@ class CertificatesRepositoryImpl implements CertificatesRepository {
|
||||
|
||||
// 4. Save certificate via V2 API
|
||||
await _api.post(
|
||||
StaffEndpoints.certificates.path,
|
||||
StaffEndpoints.certificates,
|
||||
data: <String, dynamic>{
|
||||
'certificateType': certificateType,
|
||||
'name': name,
|
||||
@@ -95,7 +95,7 @@ class CertificatesRepositoryImpl implements CertificatesRepository {
|
||||
@override
|
||||
Future<void> deleteCertificate({required String certificateId}) async {
|
||||
await _api.delete(
|
||||
StaffEndpoints.certificateDelete(certificateId).path,
|
||||
StaffEndpoints.certificateDelete(certificateId),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class DocumentsRepositoryImpl implements DocumentsRepository {
|
||||
@override
|
||||
Future<List<ProfileDocument>> getDocuments() async {
|
||||
final ApiResponse response =
|
||||
await _api.get(StaffEndpoints.documents.path);
|
||||
await _api.get(StaffEndpoints.documents);
|
||||
final List<dynamic> items = response.data['documents'] as List<dynamic>;
|
||||
return items
|
||||
.map((dynamic json) =>
|
||||
@@ -64,7 +64,7 @@ class DocumentsRepositoryImpl implements DocumentsRepository {
|
||||
|
||||
// 4. Submit upload result to V2 API
|
||||
await _api.put(
|
||||
StaffEndpoints.documentUpload(documentId).path,
|
||||
StaffEndpoints.documentUpload(documentId),
|
||||
data: <String, dynamic>{
|
||||
'fileUri': signedUrlRes.signedUrl,
|
||||
'verificationId': verificationRes.verificationId,
|
||||
|
||||
@@ -18,7 +18,7 @@ class TaxFormsRepositoryImpl implements TaxFormsRepository {
|
||||
@override
|
||||
Future<List<TaxForm>> getTaxForms() async {
|
||||
final ApiResponse response =
|
||||
await _api.get(StaffEndpoints.taxForms.path);
|
||||
await _api.get(StaffEndpoints.taxForms);
|
||||
final List<dynamic> items = response.data['taxForms'] as List<dynamic>;
|
||||
return items
|
||||
.map((dynamic json) =>
|
||||
@@ -29,7 +29,7 @@ class TaxFormsRepositoryImpl implements TaxFormsRepository {
|
||||
@override
|
||||
Future<void> updateTaxForm(TaxForm form) async {
|
||||
await _api.put(
|
||||
StaffEndpoints.taxFormUpdate(form.formType).path,
|
||||
StaffEndpoints.taxFormUpdate(form.formType),
|
||||
data: form.toJson(),
|
||||
);
|
||||
}
|
||||
@@ -37,7 +37,7 @@ class TaxFormsRepositoryImpl implements TaxFormsRepository {
|
||||
@override
|
||||
Future<void> submitTaxForm(TaxForm form) async {
|
||||
await _api.post(
|
||||
StaffEndpoints.taxFormSubmit(form.formType).path,
|
||||
StaffEndpoints.taxFormSubmit(form.formType),
|
||||
data: form.toJson(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ class BankAccountRepositoryImpl implements BankAccountRepository {
|
||||
@override
|
||||
Future<List<BankAccount>> getAccounts() async {
|
||||
final ApiResponse response =
|
||||
await _api.get(StaffEndpoints.bankAccounts.path);
|
||||
await _api.get(StaffEndpoints.bankAccounts);
|
||||
final List<dynamic> items = response.data['accounts'] as List<dynamic>;
|
||||
return items
|
||||
.map((dynamic json) =>
|
||||
@@ -27,7 +27,7 @@ class BankAccountRepositoryImpl implements BankAccountRepository {
|
||||
@override
|
||||
Future<void> addAccount(BankAccount account) async {
|
||||
await _api.post(
|
||||
StaffEndpoints.bankAccounts.path,
|
||||
StaffEndpoints.bankAccounts,
|
||||
data: account.toJson(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ class TimeCardRepositoryImpl implements TimeCardRepository {
|
||||
@override
|
||||
Future<List<TimeCardEntry>> getTimeCards(DateTime month) async {
|
||||
final ApiResponse response = await _api.get(
|
||||
StaffEndpoints.timeCard.path,
|
||||
StaffEndpoints.timeCard,
|
||||
params: <String, dynamic>{
|
||||
'year': month.year,
|
||||
'month': month.month,
|
||||
|
||||
@@ -27,7 +27,7 @@ class AttireRepositoryImpl implements AttireRepository {
|
||||
|
||||
@override
|
||||
Future<List<AttireChecklist>> getAttireOptions() async {
|
||||
final ApiResponse response = await _api.get(StaffEndpoints.attire.path);
|
||||
final ApiResponse response = await _api.get(StaffEndpoints.attire);
|
||||
final List<dynamic> items = response.data['items'] as List<dynamic>;
|
||||
return items
|
||||
.map((dynamic json) =>
|
||||
@@ -100,7 +100,7 @@ class AttireRepositoryImpl implements AttireRepository {
|
||||
|
||||
// 5. Update attire item via V2 API
|
||||
await _api.put(
|
||||
StaffEndpoints.attireUpload(itemId).path,
|
||||
StaffEndpoints.attireUpload(itemId),
|
||||
data: <String, dynamic>{
|
||||
'photoUrl': photoUrl,
|
||||
'verificationId': verifyRes.verificationId,
|
||||
|
||||
@@ -17,7 +17,7 @@ class EmergencyContactRepositoryImpl
|
||||
@override
|
||||
Future<List<EmergencyContact>> getContacts() async {
|
||||
final ApiResponse response =
|
||||
await _api.get(StaffEndpoints.emergencyContacts.path);
|
||||
await _api.get(StaffEndpoints.emergencyContacts);
|
||||
final List<dynamic> items = response.data['contacts'] as List<dynamic>;
|
||||
return items
|
||||
.map((dynamic json) =>
|
||||
@@ -28,7 +28,7 @@ class EmergencyContactRepositoryImpl
|
||||
@override
|
||||
Future<void> saveContacts(List<EmergencyContact> contacts) async {
|
||||
await _api.put(
|
||||
StaffEndpoints.emergencyContacts.path,
|
||||
StaffEndpoints.emergencyContacts,
|
||||
data: <String, dynamic>{
|
||||
'contacts':
|
||||
contacts.map((EmergencyContact c) => c.toJson()).toList(),
|
||||
|
||||
@@ -16,14 +16,14 @@ class ExperienceRepositoryImpl implements ExperienceRepositoryInterface {
|
||||
@override
|
||||
Future<List<String>> getIndustries() async {
|
||||
final ApiResponse response =
|
||||
await _api.get(StaffEndpoints.industries.path);
|
||||
await _api.get(StaffEndpoints.industries);
|
||||
final List<dynamic> items = response.data['industries'] as List<dynamic>;
|
||||
return items.map((dynamic e) => e.toString()).toList();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<String>> getSkills() async {
|
||||
final ApiResponse response = await _api.get(StaffEndpoints.skills.path);
|
||||
final ApiResponse response = await _api.get(StaffEndpoints.skills);
|
||||
final List<dynamic> items = response.data['skills'] as List<dynamic>;
|
||||
return items.map((dynamic e) => e.toString()).toList();
|
||||
}
|
||||
@@ -34,7 +34,7 @@ class ExperienceRepositoryImpl implements ExperienceRepositoryInterface {
|
||||
List<String> skills,
|
||||
) async {
|
||||
await _api.put(
|
||||
StaffEndpoints.personalInfo.path,
|
||||
StaffEndpoints.personalInfo,
|
||||
data: <String, dynamic>{
|
||||
'industries': industries,
|
||||
'skills': skills,
|
||||
|
||||
@@ -28,7 +28,7 @@ class PersonalInfoRepositoryImpl implements PersonalInfoRepositoryInterface {
|
||||
@override
|
||||
Future<StaffPersonalInfo> getStaffProfile() async {
|
||||
final ApiResponse response =
|
||||
await _api.get(StaffEndpoints.personalInfo.path);
|
||||
await _api.get(StaffEndpoints.personalInfo);
|
||||
final Map<String, dynamic> json =
|
||||
response.data as Map<String, dynamic>;
|
||||
return StaffPersonalInfo.fromJson(json);
|
||||
@@ -40,7 +40,7 @@ class PersonalInfoRepositoryImpl implements PersonalInfoRepositoryInterface {
|
||||
required Map<String, dynamic> data,
|
||||
}) async {
|
||||
final ApiResponse response = await _api.put(
|
||||
StaffEndpoints.personalInfo.path,
|
||||
StaffEndpoints.personalInfo,
|
||||
data: data,
|
||||
);
|
||||
final Map<String, dynamic> json =
|
||||
@@ -65,7 +65,7 @@ class PersonalInfoRepositoryImpl implements PersonalInfoRepositoryInterface {
|
||||
|
||||
// 3. Submit the photo URL to the V2 API.
|
||||
await _api.post(
|
||||
StaffEndpoints.profilePhoto.path,
|
||||
StaffEndpoints.profilePhoto,
|
||||
data: <String, dynamic>{
|
||||
'fileUri': uploadRes.fileUri,
|
||||
'photoUrl': photoUrl,
|
||||
|
||||
@@ -18,7 +18,7 @@ class FaqsRepositoryImpl implements FaqsRepositoryInterface {
|
||||
Future<List<FaqCategory>> getFaqs() async {
|
||||
try {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(StaffEndpoints.faqs.path);
|
||||
await _apiService.get(StaffEndpoints.faqs);
|
||||
return _parseCategories(response);
|
||||
} catch (_) {
|
||||
return <FaqCategory>[];
|
||||
@@ -29,7 +29,7 @@ class FaqsRepositoryImpl implements FaqsRepositoryInterface {
|
||||
Future<List<FaqCategory>> searchFaqs(String query) async {
|
||||
try {
|
||||
final ApiResponse response = await _apiService.get(
|
||||
StaffEndpoints.faqsSearch.path,
|
||||
StaffEndpoints.faqsSearch,
|
||||
params: <String, dynamic>{'q': query},
|
||||
);
|
||||
return _parseCategories(response);
|
||||
|
||||
@@ -19,7 +19,7 @@ class PrivacySettingsRepositoryImpl
|
||||
@override
|
||||
Future<bool> getProfileVisibility() async {
|
||||
final ApiResponse response =
|
||||
await _api.get(StaffEndpoints.privacy.path);
|
||||
await _api.get(StaffEndpoints.privacy);
|
||||
final Map<String, dynamic> json =
|
||||
response.data as Map<String, dynamic>;
|
||||
final PrivacySettings settings = PrivacySettings.fromJson(json);
|
||||
@@ -29,7 +29,7 @@ class PrivacySettingsRepositoryImpl
|
||||
@override
|
||||
Future<bool> updateProfileVisibility(bool isVisible) async {
|
||||
await _api.put(
|
||||
StaffEndpoints.privacy.path,
|
||||
StaffEndpoints.privacy,
|
||||
data: <String, dynamic>{'profileVisible': isVisible},
|
||||
);
|
||||
return isVisible;
|
||||
|
||||
@@ -34,7 +34,7 @@ class ShiftsRepositoryImpl implements ShiftsRepositoryInterface {
|
||||
required DateTime end,
|
||||
}) async {
|
||||
final ApiResponse response = await _apiService.get(
|
||||
StaffEndpoints.shiftsAssigned.path,
|
||||
StaffEndpoints.shiftsAssigned,
|
||||
params: <String, dynamic>{
|
||||
'startDate': start.toIso8601String(),
|
||||
'endDate': end.toIso8601String(),
|
||||
@@ -59,7 +59,7 @@ class ShiftsRepositoryImpl implements ShiftsRepositoryInterface {
|
||||
params['search'] = search;
|
||||
}
|
||||
final ApiResponse response = await _apiService.get(
|
||||
StaffEndpoints.shiftsOpen.path,
|
||||
StaffEndpoints.shiftsOpen,
|
||||
params: params,
|
||||
);
|
||||
final List<dynamic> items = _extractItems(response.data);
|
||||
@@ -72,7 +72,7 @@ class ShiftsRepositoryImpl implements ShiftsRepositoryInterface {
|
||||
@override
|
||||
Future<List<PendingAssignment>> getPendingAssignments() async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(StaffEndpoints.shiftsPending.path);
|
||||
await _apiService.get(StaffEndpoints.shiftsPending);
|
||||
final List<dynamic> items = _extractItems(response.data);
|
||||
return items
|
||||
.map((dynamic json) =>
|
||||
@@ -83,7 +83,7 @@ class ShiftsRepositoryImpl implements ShiftsRepositoryInterface {
|
||||
@override
|
||||
Future<List<CancelledShift>> getCancelledShifts() async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(StaffEndpoints.shiftsCancelled.path);
|
||||
await _apiService.get(StaffEndpoints.shiftsCancelled);
|
||||
final List<dynamic> items = _extractItems(response.data);
|
||||
return items
|
||||
.map((dynamic json) =>
|
||||
@@ -94,7 +94,7 @@ class ShiftsRepositoryImpl implements ShiftsRepositoryInterface {
|
||||
@override
|
||||
Future<List<CompletedShift>> getCompletedShifts() async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(StaffEndpoints.shiftsCompleted.path);
|
||||
await _apiService.get(StaffEndpoints.shiftsCompleted);
|
||||
final List<dynamic> items = _extractItems(response.data);
|
||||
return items
|
||||
.map((dynamic json) =>
|
||||
@@ -105,7 +105,7 @@ class ShiftsRepositoryImpl implements ShiftsRepositoryInterface {
|
||||
@override
|
||||
Future<ShiftDetail?> getShiftDetail(String shiftId) async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(StaffEndpoints.shiftDetails(shiftId).path);
|
||||
await _apiService.get(StaffEndpoints.shiftDetails(shiftId));
|
||||
if (response.data == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -119,7 +119,7 @@ class ShiftsRepositoryImpl implements ShiftsRepositoryInterface {
|
||||
bool instantBook = false,
|
||||
}) async {
|
||||
await _apiService.post(
|
||||
StaffEndpoints.shiftApply(shiftId).path,
|
||||
StaffEndpoints.shiftApply(shiftId),
|
||||
data: <String, dynamic>{
|
||||
if (roleId != null) 'roleId': roleId,
|
||||
'instantBook': instantBook,
|
||||
@@ -129,18 +129,18 @@ class ShiftsRepositoryImpl implements ShiftsRepositoryInterface {
|
||||
|
||||
@override
|
||||
Future<void> acceptShift(String shiftId) async {
|
||||
await _apiService.post(StaffEndpoints.shiftAccept(shiftId).path);
|
||||
await _apiService.post(StaffEndpoints.shiftAccept(shiftId));
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> declineShift(String shiftId) async {
|
||||
await _apiService.post(StaffEndpoints.shiftDecline(shiftId).path);
|
||||
await _apiService.post(StaffEndpoints.shiftDecline(shiftId));
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> requestSwap(String shiftId, {String? reason}) async {
|
||||
await _apiService.post(
|
||||
StaffEndpoints.shiftRequestSwap(shiftId).path,
|
||||
StaffEndpoints.shiftRequestSwap(shiftId),
|
||||
data: <String, dynamic>{
|
||||
if (reason != null) 'reason': reason,
|
||||
},
|
||||
@@ -150,7 +150,7 @@ class ShiftsRepositoryImpl implements ShiftsRepositoryInterface {
|
||||
@override
|
||||
Future<bool> getProfileCompletion() async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(StaffEndpoints.profileCompletion.path);
|
||||
await _apiService.get(StaffEndpoints.profileCompletion);
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
final ProfileCompletion completion = ProfileCompletion.fromJson(data);
|
||||
return completion.completed;
|
||||
|
||||
@@ -23,7 +23,7 @@ class StaffMainRepositoryImpl implements StaffMainRepositoryInterface {
|
||||
Future<bool> getProfileCompletion() async {
|
||||
try {
|
||||
final ApiResponse response = await _apiService.get(
|
||||
StaffEndpoints.profileCompletion.path,
|
||||
StaffEndpoints.profileCompletion,
|
||||
);
|
||||
|
||||
if (response.data is Map<String, dynamic>) {
|
||||
|
||||
Reference in New Issue
Block a user