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

@@ -26,9 +26,6 @@ export 'src/services/api_service/endpoints/auth_endpoints.dart';
export 'src/services/api_service/endpoints/client_endpoints.dart';
export 'src/services/api_service/endpoints/core_endpoints.dart';
export 'src/services/api_service/endpoints/staff_endpoints.dart';
// Backward-compatible facades (deprecated)
export 'src/services/api_service/core_api_services/core_api_endpoints.dart';
export 'src/services/api_service/core_api_services/v2_api_endpoints.dart';
export 'src/services/api_service/core_api_services/file_upload/file_upload_service.dart';
export 'src/services/api_service/core_api_services/file_upload/file_upload_response.dart';
export 'src/services/api_service/core_api_services/signed_url/signed_url_service.dart';

View File

@@ -1,41 +0,0 @@
import 'package:krow_core/src/services/api_service/endpoints/core_endpoints.dart';
/// Backward-compatible facade that re-exports all Core API endpoints as
/// [String] paths.
///
/// New code should use [CoreEndpoints] directly.
@Deprecated('Use CoreEndpoints directly')
class CoreApiEndpoints {
CoreApiEndpoints._();
/// Upload a file.
static String get uploadFile => CoreEndpoints.uploadFile.path;
/// Create a signed URL for a file.
static String get createSignedUrl => CoreEndpoints.createSignedUrl.path;
/// Invoke a Large Language Model.
static String get invokeLlm => CoreEndpoints.invokeLlm.path;
/// Root for verification operations.
static String get verifications => CoreEndpoints.verifications.path;
/// Get status of a verification job.
static String verificationStatus(String id) =>
CoreEndpoints.verificationStatus(id).path;
/// Review a verification decision.
static String verificationReview(String id) =>
CoreEndpoints.verificationReview(id).path;
/// Retry a verification job.
static String verificationRetry(String id) =>
CoreEndpoints.verificationRetry(id).path;
/// Transcribe audio to text for rapid orders.
static String get transcribeRapidOrder =>
CoreEndpoints.transcribeRapidOrder.path;
/// Parse text to structured rapid order.
static String get parseRapidOrder => CoreEndpoints.parseRapidOrder.path;
}

View File

@@ -1,6 +1,6 @@
import 'package:dio/dio.dart';
import 'package:krow_domain/krow_domain.dart';
import '../core_api_endpoints.dart';
import '../../endpoints/core_endpoints.dart';
import 'file_upload_response.dart';
/// Service for uploading files to the Core API.
@@ -26,7 +26,7 @@ class FileUploadService extends BaseCoreService {
if (category != null) 'category': category,
});
return api.post(CoreApiEndpoints.uploadFile, data: formData);
return api.post(CoreEndpoints.uploadFile.path, data: formData);
});
if (res.code.startsWith('2')) {

View File

@@ -1,5 +1,5 @@
import 'package:krow_domain/krow_domain.dart';
import '../core_api_endpoints.dart';
import '../../endpoints/core_endpoints.dart';
import 'llm_response.dart';
/// Service for invoking Large Language Models (LLM).
@@ -19,7 +19,7 @@ class LlmService extends BaseCoreService {
}) async {
final ApiResponse res = await action(() async {
return api.post(
CoreApiEndpoints.invokeLlm,
CoreEndpoints.invokeLlm.path,
data: <String, dynamic>{
'prompt': prompt,
if (responseJsonSchema != null)

View File

@@ -1,5 +1,5 @@
import 'package:krow_domain/krow_domain.dart';
import '../core_api_endpoints.dart';
import '../../endpoints/core_endpoints.dart';
import 'rapid_order_response.dart';
/// Service for handling RAPID order operations (Transcription and Parsing).
@@ -19,7 +19,7 @@ class RapidOrderService extends BaseCoreService {
}) async {
final ApiResponse res = await action(() async {
return api.post(
CoreApiEndpoints.transcribeRapidOrder,
CoreEndpoints.transcribeRapidOrder.path,
data: <String, dynamic>{
'audioFileUri': audioFileUri,
'locale': locale,
@@ -51,7 +51,7 @@ class RapidOrderService extends BaseCoreService {
}) async {
final ApiResponse res = await action(() async {
return api.post(
CoreApiEndpoints.parseRapidOrder,
CoreEndpoints.parseRapidOrder.path,
data: <String, dynamic>{
'text': text,
'locale': locale,

View File

@@ -1,5 +1,5 @@
import 'package:krow_domain/krow_domain.dart';
import '../core_api_endpoints.dart';
import '../../endpoints/core_endpoints.dart';
import 'signed_url_response.dart';
/// Service for creating signed URLs for Cloud Storage objects.
@@ -17,7 +17,7 @@ class SignedUrlService extends BaseCoreService {
}) async {
final ApiResponse res = await action(() async {
return api.post(
CoreApiEndpoints.createSignedUrl,
CoreEndpoints.createSignedUrl.path,
data: <String, dynamic>{
'fileUri': fileUri,
'expiresInSeconds': expiresInSeconds,

View File

@@ -1,358 +0,0 @@
import 'package:krow_core/src/services/api_service/endpoints/auth_endpoints.dart';
import 'package:krow_core/src/services/api_service/endpoints/client_endpoints.dart';
import 'package:krow_core/src/services/api_service/endpoints/staff_endpoints.dart';
/// Backward-compatible facade that re-exports all V2 endpoints as [String]
/// paths.
///
/// New code should use [AuthEndpoints], [StaffEndpoints], or
/// [ClientEndpoints] directly.
@Deprecated(
'Use AuthEndpoints, StaffEndpoints, or ClientEndpoints directly',
)
class V2ApiEndpoints {
V2ApiEndpoints._();
// ── Auth ──────────────────────────────────────────────────────────────
/// Client email/password sign-in.
static String get clientSignIn => AuthEndpoints.clientSignIn.path;
/// Client business registration.
static String get clientSignUp => AuthEndpoints.clientSignUp.path;
/// Client sign-out.
static String get clientSignOut => AuthEndpoints.clientSignOut.path;
/// Start staff phone verification (SMS).
static String get staffPhoneStart => AuthEndpoints.staffPhoneStart.path;
/// Complete staff phone verification.
static String get staffPhoneVerify => AuthEndpoints.staffPhoneVerify.path;
/// Generic sign-out.
static String get signOut => AuthEndpoints.signOut.path;
/// Staff-specific sign-out.
static String get staffSignOut => AuthEndpoints.staffSignOut.path;
/// Get current session data.
static String get session => AuthEndpoints.session.path;
// ── Staff Read ────────────────────────────────────────────────────────
/// Staff session data.
static String get staffSession => StaffEndpoints.session.path;
/// Staff dashboard overview.
static String get staffDashboard => StaffEndpoints.dashboard.path;
/// Staff profile completion status.
static String get staffProfileCompletion =>
StaffEndpoints.profileCompletion.path;
/// Staff availability schedule.
static String get staffAvailability => StaffEndpoints.availability.path;
/// Today's shifts for clock-in.
static String get staffClockInShiftsToday =>
StaffEndpoints.clockInShiftsToday.path;
/// Current clock-in status.
static String get staffClockInStatus => StaffEndpoints.clockInStatus.path;
/// Payments summary.
static String get staffPaymentsSummary =>
StaffEndpoints.paymentsSummary.path;
/// Payments history.
static String get staffPaymentsHistory =>
StaffEndpoints.paymentsHistory.path;
/// Payments chart data.
static String get staffPaymentsChart => StaffEndpoints.paymentsChart.path;
/// Assigned shifts.
static String get staffShiftsAssigned =>
StaffEndpoints.shiftsAssigned.path;
/// Open shifts available to apply.
static String get staffShiftsOpen => StaffEndpoints.shiftsOpen.path;
/// Pending shift assignments.
static String get staffShiftsPending => StaffEndpoints.shiftsPending.path;
/// Cancelled shifts.
static String get staffShiftsCancelled =>
StaffEndpoints.shiftsCancelled.path;
/// Completed shifts.
static String get staffShiftsCompleted =>
StaffEndpoints.shiftsCompleted.path;
/// Shift details by ID.
static String staffShiftDetails(String shiftId) =>
StaffEndpoints.shiftDetails(shiftId).path;
/// Staff profile sections overview.
static String get staffProfileSections =>
StaffEndpoints.profileSections.path;
/// Personal info.
static String get staffPersonalInfo => StaffEndpoints.personalInfo.path;
/// Industries/experience.
static String get staffIndustries => StaffEndpoints.industries.path;
/// Skills.
static String get staffSkills => StaffEndpoints.skills.path;
/// Documents.
static String get staffDocuments => StaffEndpoints.documents.path;
/// Attire items.
static String get staffAttire => StaffEndpoints.attire.path;
/// Tax forms.
static String get staffTaxForms => StaffEndpoints.taxForms.path;
/// Emergency contacts.
static String get staffEmergencyContacts =>
StaffEndpoints.emergencyContacts.path;
/// Certificates.
static String get staffCertificates => StaffEndpoints.certificates.path;
/// Bank accounts.
static String get staffBankAccounts => StaffEndpoints.bankAccounts.path;
/// Benefits.
static String get staffBenefits => StaffEndpoints.benefits.path;
/// Time card.
static String get staffTimeCard => StaffEndpoints.timeCard.path;
/// Privacy settings.
static String get staffPrivacy => StaffEndpoints.privacy.path;
/// FAQs.
static String get staffFaqs => StaffEndpoints.faqs.path;
/// FAQs search.
static String get staffFaqsSearch => StaffEndpoints.faqsSearch.path;
// ── Staff Write ───────────────────────────────────────────────────────
/// Staff profile setup.
static String get staffProfileSetup => StaffEndpoints.profileSetup.path;
/// Clock in.
static String get staffClockIn => StaffEndpoints.clockIn.path;
/// Clock out.
static String get staffClockOut => StaffEndpoints.clockOut.path;
/// Quick-set availability.
static String get staffAvailabilityQuickSet =>
StaffEndpoints.availabilityQuickSet.path;
/// Apply for a shift.
static String staffShiftApply(String shiftId) =>
StaffEndpoints.shiftApply(shiftId).path;
/// Accept a shift.
static String staffShiftAccept(String shiftId) =>
StaffEndpoints.shiftAccept(shiftId).path;
/// Decline a shift.
static String staffShiftDecline(String shiftId) =>
StaffEndpoints.shiftDecline(shiftId).path;
/// Request a shift swap.
static String staffShiftRequestSwap(String shiftId) =>
StaffEndpoints.shiftRequestSwap(shiftId).path;
/// Update emergency contact by ID.
static String staffEmergencyContactUpdate(String contactId) =>
StaffEndpoints.emergencyContactUpdate(contactId).path;
/// Update tax form by type.
static String staffTaxFormUpdate(String formType) =>
StaffEndpoints.taxFormUpdate(formType).path;
/// Submit tax form by type.
static String staffTaxFormSubmit(String formType) =>
StaffEndpoints.taxFormSubmit(formType).path;
/// Upload staff profile photo.
static String get staffProfilePhoto => StaffEndpoints.profilePhoto.path;
/// Upload document by ID.
static String staffDocumentUpload(String documentId) =>
StaffEndpoints.documentUpload(documentId).path;
/// Upload attire by ID.
static String staffAttireUpload(String documentId) =>
StaffEndpoints.attireUpload(documentId).path;
/// Delete certificate by ID.
static String staffCertificateDelete(String certificateId) =>
StaffEndpoints.certificateDelete(certificateId).path;
// ── Client Read ───────────────────────────────────────────────────────
/// Client session data.
static String get clientSession => ClientEndpoints.session.path;
/// Client dashboard.
static String get clientDashboard => ClientEndpoints.dashboard.path;
/// Client reorders.
static String get clientReorders => ClientEndpoints.reorders.path;
/// Billing accounts.
static String get clientBillingAccounts =>
ClientEndpoints.billingAccounts.path;
/// Pending invoices.
static String get clientBillingInvoicesPending =>
ClientEndpoints.billingInvoicesPending.path;
/// Invoice history.
static String get clientBillingInvoicesHistory =>
ClientEndpoints.billingInvoicesHistory.path;
/// Current bill.
static String get clientBillingCurrentBill =>
ClientEndpoints.billingCurrentBill.path;
/// Savings data.
static String get clientBillingSavings =>
ClientEndpoints.billingSavings.path;
/// Spend breakdown.
static String get clientBillingSpendBreakdown =>
ClientEndpoints.billingSpendBreakdown.path;
/// Coverage overview.
static String get clientCoverage => ClientEndpoints.coverage.path;
/// Coverage stats.
static String get clientCoverageStats =>
ClientEndpoints.coverageStats.path;
/// Core team.
static String get clientCoverageCoreTeam =>
ClientEndpoints.coverageCoreTeam.path;
/// Hubs list.
static String get clientHubs => ClientEndpoints.hubs.path;
/// Cost centers.
static String get clientCostCenters => ClientEndpoints.costCenters.path;
/// Vendors.
static String get clientVendors => ClientEndpoints.vendors.path;
/// Vendor roles by ID.
static String clientVendorRoles(String vendorId) =>
ClientEndpoints.vendorRoles(vendorId).path;
/// Hub managers by ID.
static String clientHubManagers(String hubId) =>
ClientEndpoints.hubManagers(hubId).path;
/// Team members.
static String get clientTeamMembers => ClientEndpoints.teamMembers.path;
/// View orders.
static String get clientOrdersView => ClientEndpoints.ordersView.path;
/// Order reorder preview.
static String clientOrderReorderPreview(String orderId) =>
ClientEndpoints.orderReorderPreview(orderId).path;
/// Reports summary.
static String get clientReportsSummary =>
ClientEndpoints.reportsSummary.path;
/// Daily ops report.
static String get clientReportsDailyOps =>
ClientEndpoints.reportsDailyOps.path;
/// Spend report.
static String get clientReportsSpend => ClientEndpoints.reportsSpend.path;
/// Coverage report.
static String get clientReportsCoverage =>
ClientEndpoints.reportsCoverage.path;
/// Forecast report.
static String get clientReportsForecast =>
ClientEndpoints.reportsForecast.path;
/// Performance report.
static String get clientReportsPerformance =>
ClientEndpoints.reportsPerformance.path;
/// No-show report.
static String get clientReportsNoShow =>
ClientEndpoints.reportsNoShow.path;
// ── Client Write ──────────────────────────────────────────────────────
/// Create one-time order.
static String get clientOrdersOneTime =>
ClientEndpoints.ordersOneTime.path;
/// Create recurring order.
static String get clientOrdersRecurring =>
ClientEndpoints.ordersRecurring.path;
/// Create permanent order.
static String get clientOrdersPermanent =>
ClientEndpoints.ordersPermanent.path;
/// Edit order by ID.
static String clientOrderEdit(String orderId) =>
ClientEndpoints.orderEdit(orderId).path;
/// Cancel order by ID.
static String clientOrderCancel(String orderId) =>
ClientEndpoints.orderCancel(orderId).path;
/// Create hub.
static String get clientHubCreate => ClientEndpoints.hubCreate.path;
/// Update hub by ID.
static String clientHubUpdate(String hubId) =>
ClientEndpoints.hubUpdate(hubId).path;
/// Delete hub by ID.
static String clientHubDelete(String hubId) =>
ClientEndpoints.hubDelete(hubId).path;
/// Assign NFC to hub.
static String clientHubAssignNfc(String hubId) =>
ClientEndpoints.hubAssignNfc(hubId).path;
/// Assign managers to hub.
static String clientHubAssignManagers(String hubId) =>
ClientEndpoints.hubAssignManagers(hubId).path;
/// Approve invoice.
static String clientInvoiceApprove(String invoiceId) =>
ClientEndpoints.invoiceApprove(invoiceId).path;
/// Dispute invoice.
static String clientInvoiceDispute(String invoiceId) =>
ClientEndpoints.invoiceDispute(invoiceId).path;
/// Submit coverage review.
static String get clientCoverageReviews =>
ClientEndpoints.coverageReviews.path;
/// Cancel late worker assignment.
static String clientCoverageCancelLateWorker(String assignmentId) =>
ClientEndpoints.coverageCancelLateWorker(assignmentId).path;
}

View File

@@ -1,5 +1,5 @@
import 'package:krow_domain/krow_domain.dart';
import '../core_api_endpoints.dart';
import '../../endpoints/core_endpoints.dart';
import 'verification_response.dart';
/// Service for handling async verification jobs.
@@ -22,7 +22,7 @@ class VerificationService extends BaseCoreService {
}) async {
final ApiResponse res = await action(() async {
return api.post(
CoreApiEndpoints.verifications,
CoreEndpoints.verifications.path,
data: <String, dynamic>{
'type': type,
'subjectType': subjectType,
@@ -44,7 +44,7 @@ class VerificationService extends BaseCoreService {
/// Polls the status of a specific verification.
Future<VerificationResponse> getStatus(String verificationId) async {
final ApiResponse res = await action(() async {
return api.get(CoreApiEndpoints.verificationStatus(verificationId));
return api.get(CoreEndpoints.verificationStatus(verificationId).path);
});
if (res.code.startsWith('2')) {
@@ -65,7 +65,7 @@ class VerificationService extends BaseCoreService {
}) async {
final ApiResponse res = await action(() async {
return api.post(
CoreApiEndpoints.verificationReview(verificationId),
CoreEndpoints.verificationReview(verificationId).path,
data: <String, dynamic>{
'decision': decision,
if (note != null) 'note': note,
@@ -84,7 +84,7 @@ class VerificationService extends BaseCoreService {
/// Retries a verification job that failed or needs re-processing.
Future<VerificationResponse> retryVerification(String verificationId) async {
final ApiResponse res = await action(() async {
return api.post(CoreApiEndpoints.verificationRetry(verificationId));
return api.post(CoreEndpoints.verificationRetry(verificationId).path);
});
if (res.code.startsWith('2')) {

View File

@@ -3,7 +3,7 @@ import 'package:flutter/foundation.dart';
import 'package:krow_domain/krow_domain.dart';
import '../api_service/api_service.dart';
import '../api_service/core_api_services/v2_api_endpoints.dart';
import '../api_service/endpoints/auth_endpoints.dart';
import '../api_service/mixins/session_handler_mixin.dart';
import 'client_session_store.dart';
import 'staff_session_store.dart';
@@ -51,7 +51,7 @@ class V2SessionService with SessionHandlerMixin {
return null;
}
final ApiResponse response = await api.get(V2ApiEndpoints.session);
final ApiResponse response = await api.get(AuthEndpoints.session.path);
if (response.data is Map<String, dynamic>) {
final Map<String, dynamic> data =
@@ -99,7 +99,7 @@ class V2SessionService with SessionHandlerMixin {
final BaseApiService? api = _apiService;
if (api != null) {
try {
await api.post(V2ApiEndpoints.signOut);
await api.post(AuthEndpoints.signOut.path);
} catch (e) {
debugPrint('[V2SessionService] Server sign-out failed: $e');
}