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:
Achintha Isuru
2026-03-17 11:40:15 -04:00
parent 31231c1e6d
commit 57bba8ab4e
46 changed files with 134 additions and 544 deletions

View File

@@ -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>;