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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user