Refactor API endpoint usage across multiple repositories to use ClientEndpoints and StaffEndpoints
- Updated ClientOrderQueryRepositoryImpl to replace V2ApiEndpoints with ClientEndpoints for vendor, role, hub, and manager retrieval methods. - Modified ViewOrdersRepositoryImpl to utilize ClientEndpoints for order viewing, editing, and vendor retrieval. - Refactored ReportsRepositoryImpl to switch from V2ApiEndpoints to ClientEndpoints for various report fetching methods. - Changed SettingsRepositoryImpl to use AuthEndpoints for sign-out functionality. - Adjusted AuthRepositoryImpl to replace V2ApiEndpoints with AuthEndpoints for phone authentication and sign-out processes. - Updated ProfileSetupRepositoryImpl to utilize StaffEndpoints for profile setup. - Refactored AvailabilityRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for availability management. - Changed ClockInRepositoryImpl to use StaffEndpoints for clock-in and clock-out functionalities. - Updated HomeRepositoryImpl to replace V2ApiEndpoints with StaffEndpoints for dashboard and profile completion retrieval. - Refactored PaymentsRepositoryImpl to utilize StaffEndpoints for payment summaries and history. - Changed ProfileRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for staff profile and section status retrieval. - Updated CertificatesRepositoryImpl to use StaffEndpoints for certificate management. - Refactored DocumentsRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for document management. - Changed TaxFormsRepositoryImpl to utilize StaffEndpoints for tax form management. - Updated BankAccountRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for bank account management. - Refactored TimeCardRepositoryImpl to use StaffEndpoints for time card retrieval. - Changed AttireRepositoryImpl to utilize StaffEndpoints for attire management. - Updated EmergencyContactRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for emergency contact management. - Refactored ExperienceRepositoryImpl to use StaffEndpoints for industry and skill retrieval. - Changed PersonalInfoRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for personal information management. - Updated FaqsRepositoryImpl to utilize StaffEndpoints for FAQs retrieval. - Refactored PrivacySettingsRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for privacy settings management. - Changed ShiftsRepositoryImpl to use StaffEndpoints for shift management and retrieval. - Updated StaffMainRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for profile completion checks.
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(
|
||||
V2ApiEndpoints.clientSignIn,
|
||||
AuthEndpoints.clientSignIn.path,
|
||||
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(
|
||||
V2ApiEndpoints.clientSignUp,
|
||||
AuthEndpoints.clientSignUp.path,
|
||||
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(V2ApiEndpoints.clientSignOut);
|
||||
await _apiService.post(AuthEndpoints.clientSignOut.path);
|
||||
} catch (e) {
|
||||
developer.log(
|
||||
'V2 sign-out request failed: $e',
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'package:billing/src/domain/repositories/billing_repository.dart';
|
||||
|
||||
/// Implementation of [BillingRepository] using the V2 REST API.
|
||||
///
|
||||
/// All backend calls go through [BaseApiService] with [V2ApiEndpoints].
|
||||
/// All backend calls go through [BaseApiService] with [ClientEndpoints].
|
||||
class BillingRepositoryImpl implements BillingRepository {
|
||||
/// Creates a [BillingRepositoryImpl].
|
||||
BillingRepositoryImpl({required BaseApiService apiService})
|
||||
@@ -17,7 +17,7 @@ class BillingRepositoryImpl implements BillingRepository {
|
||||
@override
|
||||
Future<List<BillingAccount>> getBankAccounts() async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(V2ApiEndpoints.clientBillingAccounts);
|
||||
await _apiService.get(ClientEndpoints.billingAccounts.path);
|
||||
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(V2ApiEndpoints.clientBillingInvoicesPending);
|
||||
await _apiService.get(ClientEndpoints.billingInvoicesPending.path);
|
||||
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(V2ApiEndpoints.clientBillingInvoicesHistory);
|
||||
await _apiService.get(ClientEndpoints.billingInvoicesHistory.path);
|
||||
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(V2ApiEndpoints.clientBillingCurrentBill);
|
||||
await _apiService.get(ClientEndpoints.billingCurrentBill.path);
|
||||
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(V2ApiEndpoints.clientBillingSavings);
|
||||
await _apiService.get(ClientEndpoints.billingSavings.path);
|
||||
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(
|
||||
V2ApiEndpoints.clientBillingSpendBreakdown,
|
||||
ClientEndpoints.billingSpendBreakdown.path,
|
||||
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(V2ApiEndpoints.clientInvoiceApprove(id));
|
||||
await _apiService.post(ClientEndpoints.invoiceApprove(id).path);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> disputeInvoice(String id, String reason) async {
|
||||
await _apiService.post(
|
||||
V2ApiEndpoints.clientInvoiceDispute(id),
|
||||
ClientEndpoints.invoiceDispute(id).path,
|
||||
data: <String, dynamic>{'reason': reason},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Card showing a single worker's details in the completion review.
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'package:client_coverage/src/domain/repositories/coverage_repository.dart
|
||||
|
||||
/// V2 API implementation of [CoverageRepository].
|
||||
///
|
||||
/// Uses [BaseApiService] with [V2ApiEndpoints] for all backend access.
|
||||
/// Uses [BaseApiService] with [ClientEndpoints] for all backend access.
|
||||
class CoverageRepositoryImpl implements CoverageRepository {
|
||||
/// Creates a [CoverageRepositoryImpl].
|
||||
CoverageRepositoryImpl({required BaseApiService apiService})
|
||||
@@ -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(
|
||||
V2ApiEndpoints.clientCoverage,
|
||||
ClientEndpoints.coverage.path,
|
||||
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(
|
||||
V2ApiEndpoints.clientCoverageStats,
|
||||
ClientEndpoints.coverageStats.path,
|
||||
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(
|
||||
V2ApiEndpoints.clientCoverageReviews,
|
||||
ClientEndpoints.coverageReviews.path,
|
||||
data: body,
|
||||
);
|
||||
}
|
||||
@@ -82,7 +82,7 @@ class CoverageRepositoryImpl implements CoverageRepository {
|
||||
body['reason'] = reason;
|
||||
}
|
||||
await _apiService.post(
|
||||
V2ApiEndpoints.clientCoverageCancelLateWorker(assignmentId),
|
||||
ClientEndpoints.coverageCancelLateWorker(assignmentId).path,
|
||||
data: body,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ class HomeRepositoryImpl implements HomeRepositoryInterface {
|
||||
@override
|
||||
Future<ClientDashboard> getDashboard() async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(V2ApiEndpoints.clientDashboard);
|
||||
await _apiService.get(ClientEndpoints.dashboard.path);
|
||||
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(V2ApiEndpoints.clientReorders);
|
||||
await _apiService.get(ClientEndpoints.reorders.path);
|
||||
final Map<String, dynamic> body = response.data as Map<String, dynamic>;
|
||||
final List<dynamic> items = body['items'] as List<dynamic>;
|
||||
return items
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'package:client_hubs/src/domain/repositories/hub_repository_interface.dar
|
||||
|
||||
/// Implementation of [HubRepositoryInterface] using the V2 REST API.
|
||||
///
|
||||
/// All backend calls go through [BaseApiService] with [V2ApiEndpoints].
|
||||
/// All backend calls go through [BaseApiService] with [ClientEndpoints].
|
||||
class HubRepositoryImpl implements HubRepositoryInterface {
|
||||
/// Creates a [HubRepositoryImpl].
|
||||
HubRepositoryImpl({required BaseApiService apiService})
|
||||
@@ -17,7 +17,7 @@ class HubRepositoryImpl implements HubRepositoryInterface {
|
||||
@override
|
||||
Future<List<Hub>> getHubs() async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(V2ApiEndpoints.clientHubs);
|
||||
await _apiService.get(ClientEndpoints.hubs.path);
|
||||
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(V2ApiEndpoints.clientCostCenters);
|
||||
await _apiService.get(ClientEndpoints.costCenters.path);
|
||||
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(
|
||||
V2ApiEndpoints.clientHubCreate,
|
||||
ClientEndpoints.hubCreate.path,
|
||||
data: <String, dynamic>{
|
||||
'name': name,
|
||||
'fullAddress': fullAddress,
|
||||
@@ -88,7 +88,7 @@ class HubRepositoryImpl implements HubRepositoryInterface {
|
||||
String? costCenterId,
|
||||
}) async {
|
||||
final ApiResponse response = await _apiService.put(
|
||||
V2ApiEndpoints.clientHubUpdate(hubId),
|
||||
ClientEndpoints.hubUpdate(hubId).path,
|
||||
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(V2ApiEndpoints.clientHubDelete(hubId));
|
||||
await _apiService.delete(ClientEndpoints.hubDelete(hubId).path);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -120,7 +120,7 @@ class HubRepositoryImpl implements HubRepositoryInterface {
|
||||
required String nfcTagId,
|
||||
}) async {
|
||||
await _apiService.post(
|
||||
V2ApiEndpoints.clientHubAssignNfc(hubId),
|
||||
ClientEndpoints.hubAssignNfc(hubId).path,
|
||||
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(V2ApiEndpoints.clientHubManagers(hubId));
|
||||
await _apiService.get(ClientEndpoints.hubManagers(hubId).path);
|
||||
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(
|
||||
V2ApiEndpoints.clientHubAssignManagers(hubId),
|
||||
ClientEndpoints.hubAssignManagers(hubId).path,
|
||||
data: <String, dynamic>{
|
||||
'businessMembershipIds': businessMembershipIds,
|
||||
},
|
||||
|
||||
@@ -4,8 +4,6 @@ import 'package:google_places_flutter/google_places_flutter.dart';
|
||||
import 'package:google_places_flutter/model/prediction.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
|
||||
import 'package:client_hubs/src/util/hubs_constants.dart';
|
||||
|
||||
class HubAddressAutocomplete extends StatelessWidget {
|
||||
const HubAddressAutocomplete({
|
||||
required this.controller,
|
||||
|
||||
@@ -24,17 +24,17 @@ class ClientCreateOrderRepositoryImpl
|
||||
|
||||
@override
|
||||
Future<void> createOneTimeOrder(Map<String, dynamic> payload) async {
|
||||
await _api.post(V2ApiEndpoints.clientOrdersOneTime, data: payload);
|
||||
await _api.post(ClientEndpoints.ordersOneTime.path, data: payload);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> createRecurringOrder(Map<String, dynamic> payload) async {
|
||||
await _api.post(V2ApiEndpoints.clientOrdersRecurring, data: payload);
|
||||
await _api.post(ClientEndpoints.ordersRecurring.path, data: payload);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> createPermanentOrder(Map<String, dynamic> payload) async {
|
||||
await _api.post(V2ApiEndpoints.clientOrdersPermanent, data: payload);
|
||||
await _api.post(ClientEndpoints.ordersPermanent.path, data: payload);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -82,7 +82,7 @@ class ClientCreateOrderRepositoryImpl
|
||||
@override
|
||||
Future<OrderPreview> getOrderDetailsForReorder(String orderId) async {
|
||||
final ApiResponse response = await _api.get(
|
||||
V2ApiEndpoints.clientOrderReorderPreview(orderId),
|
||||
ClientEndpoints.orderReorderPreview(orderId).path,
|
||||
);
|
||||
return OrderPreview.fromJson(response.data as Map<String, dynamic>);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import '../../domain/repositories/client_order_query_repository_interface.dart';
|
||||
|
||||
/// V2 API implementation of [ClientOrderQueryRepositoryInterface].
|
||||
///
|
||||
/// Delegates all backend calls to [BaseApiService] with [V2ApiEndpoints].
|
||||
/// Delegates all backend calls to [BaseApiService] with [ClientEndpoints].
|
||||
class ClientOrderQueryRepositoryImpl
|
||||
implements ClientOrderQueryRepositoryInterface {
|
||||
/// Creates an instance backed by the given [apiService].
|
||||
@@ -19,7 +19,7 @@ class ClientOrderQueryRepositoryImpl
|
||||
|
||||
@override
|
||||
Future<List<Vendor>> getVendors() async {
|
||||
final ApiResponse response = await _api.get(V2ApiEndpoints.clientVendors);
|
||||
final ApiResponse response = await _api.get(ClientEndpoints.vendors.path);
|
||||
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(V2ApiEndpoints.clientVendorRoles(vendorId));
|
||||
await _api.get(ClientEndpoints.vendorRoles(vendorId).path);
|
||||
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(V2ApiEndpoints.clientHubs);
|
||||
final ApiResponse response = await _api.get(ClientEndpoints.hubs.path);
|
||||
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(V2ApiEndpoints.clientHubManagers(hubId));
|
||||
await _api.get(ClientEndpoints.hubManagers(hubId).path);
|
||||
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(
|
||||
V2ApiEndpoints.clientOrdersView,
|
||||
ClientEndpoints.ordersView.path,
|
||||
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(
|
||||
V2ApiEndpoints.clientOrderEdit(orderId),
|
||||
ClientEndpoints.orderEdit(orderId).path,
|
||||
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(
|
||||
V2ApiEndpoints.clientOrderCancel(orderId),
|
||||
ClientEndpoints.orderCancel(orderId).path,
|
||||
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(V2ApiEndpoints.clientVendors);
|
||||
final ApiResponse response = await _api.get(ClientEndpoints.vendors.path);
|
||||
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(V2ApiEndpoints.clientVendorRoles(vendorId));
|
||||
await _api.get(ClientEndpoints.vendorRoles(vendorId).path);
|
||||
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(V2ApiEndpoints.clientHubs);
|
||||
final ApiResponse response = await _api.get(ClientEndpoints.hubs.path);
|
||||
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(V2ApiEndpoints.clientHubManagers(hubId));
|
||||
await _api.get(ClientEndpoints.hubManagers(hubId).path);
|
||||
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>>();
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'package:client_reports/src/domain/repositories/reports_repository.dart';
|
||||
|
||||
/// V2 API implementation of [ReportsRepository].
|
||||
///
|
||||
/// Each method hits its corresponding `V2ApiEndpoints.clientReports*` endpoint,
|
||||
/// Each method hits its corresponding `ClientEndpoints.reports*` endpoint,
|
||||
/// passing date-range query parameters, and deserialises the JSON response
|
||||
/// into the relevant domain entity.
|
||||
class ReportsRepositoryImpl implements ReportsRepository {
|
||||
@@ -32,7 +32,7 @@ class ReportsRepositoryImpl implements ReportsRepository {
|
||||
required DateTime date,
|
||||
}) async {
|
||||
final ApiResponse response = await _apiService.get(
|
||||
V2ApiEndpoints.clientReportsDailyOps,
|
||||
ClientEndpoints.reportsDailyOps.path,
|
||||
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(
|
||||
V2ApiEndpoints.clientReportsSpend,
|
||||
ClientEndpoints.reportsSpend.path,
|
||||
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(
|
||||
V2ApiEndpoints.clientReportsCoverage,
|
||||
ClientEndpoints.reportsCoverage.path,
|
||||
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(
|
||||
V2ApiEndpoints.clientReportsForecast,
|
||||
ClientEndpoints.reportsForecast.path,
|
||||
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(
|
||||
V2ApiEndpoints.clientReportsPerformance,
|
||||
ClientEndpoints.reportsPerformance.path,
|
||||
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(
|
||||
V2ApiEndpoints.clientReportsNoShow,
|
||||
ClientEndpoints.reportsNoShow.path,
|
||||
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(
|
||||
V2ApiEndpoints.clientReportsSummary,
|
||||
ClientEndpoints.reportsSummary.path,
|
||||
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(V2ApiEndpoints.clientSignOut);
|
||||
await _apiService.post(AuthEndpoints.clientSignOut.path);
|
||||
} catch (e) {
|
||||
developer.log(
|
||||
'V2 sign-out request failed: $e',
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
|
||||
import '../../blocs/client_settings_bloc.dart';
|
||||
|
||||
/// A widget that displays the log out button.
|
||||
|
||||
Reference in New Issue
Block a user