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:
@@ -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';
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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')) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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')) {
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -63,7 +63,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
|
||||
|
||||
try {
|
||||
final domain.ApiResponse startResponse = await _apiService.post(
|
||||
V2ApiEndpoints.staffPhoneStart,
|
||||
AuthEndpoints.staffPhoneStart.path,
|
||||
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(
|
||||
V2ApiEndpoints.staffPhoneVerify,
|
||||
AuthEndpoints.staffPhoneVerify.path,
|
||||
data: <String, dynamic>{
|
||||
'idToken': idToken,
|
||||
'mode': v2Mode,
|
||||
@@ -233,7 +233,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
|
||||
@override
|
||||
Future<void> signOut() async {
|
||||
try {
|
||||
await _apiService.post(V2ApiEndpoints.staffSignOut);
|
||||
await _apiService.post(AuthEndpoints.staffSignOut.path);
|
||||
} 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(
|
||||
V2ApiEndpoints.staffProfileSetup,
|
||||
StaffEndpoints.profileSetup.path,
|
||||
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(
|
||||
V2ApiEndpoints.staffAvailability,
|
||||
StaffEndpoints.availability.path,
|
||||
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(
|
||||
V2ApiEndpoints.staffAvailability,
|
||||
StaffEndpoints.availability.path,
|
||||
data: <String, dynamic>{
|
||||
'dayOfWeek': dayOfWeek,
|
||||
'availabilityStatus': status.toJson(),
|
||||
@@ -86,7 +86,7 @@ class AvailabilityRepositoryImpl implements AvailabilityRepository {
|
||||
}
|
||||
|
||||
await _apiService.post(
|
||||
V2ApiEndpoints.staffAvailabilityQuickSet,
|
||||
StaffEndpoints.availabilityQuickSet.path,
|
||||
data: data,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'package:staff_clock_in/src/domain/repositories/clock_in_repository_inter
|
||||
|
||||
/// Implementation of [ClockInRepositoryInterface] using the V2 REST API.
|
||||
///
|
||||
/// All backend calls go through [BaseApiService] with [V2ApiEndpoints].
|
||||
/// All backend calls go through [BaseApiService] with [StaffEndpoints].
|
||||
/// The old Data Connect implementation has been removed.
|
||||
class ClockInRepositoryImpl implements ClockInRepositoryInterface {
|
||||
/// Creates a [ClockInRepositoryImpl] backed by the V2 API.
|
||||
@@ -17,7 +17,7 @@ class ClockInRepositoryImpl implements ClockInRepositoryInterface {
|
||||
@override
|
||||
Future<List<Shift>> getTodaysShifts() async {
|
||||
final ApiResponse response = await _apiService.get(
|
||||
V2ApiEndpoints.staffClockInShiftsToday,
|
||||
StaffEndpoints.clockInShiftsToday.path,
|
||||
);
|
||||
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(
|
||||
V2ApiEndpoints.staffClockInStatus,
|
||||
StaffEndpoints.clockInStatus.path,
|
||||
);
|
||||
return AttendanceStatus.fromJson(response.data as Map<String, dynamic>);
|
||||
}
|
||||
@@ -44,7 +44,7 @@ class ClockInRepositoryImpl implements ClockInRepositoryInterface {
|
||||
String? notes,
|
||||
}) async {
|
||||
await _apiService.post(
|
||||
V2ApiEndpoints.staffClockIn,
|
||||
StaffEndpoints.clockIn.path,
|
||||
data: <String, dynamic>{
|
||||
'shiftId': shiftId,
|
||||
'sourceType': 'GEO',
|
||||
@@ -62,7 +62,7 @@ class ClockInRepositoryImpl implements ClockInRepositoryInterface {
|
||||
String? shiftId,
|
||||
}) async {
|
||||
await _apiService.post(
|
||||
V2ApiEndpoints.staffClockOut,
|
||||
StaffEndpoints.clockOut.path,
|
||||
data: <String, dynamic>{
|
||||
if (shiftId != null) 'shiftId': shiftId,
|
||||
'sourceType': 'GEO',
|
||||
|
||||
@@ -16,19 +16,19 @@ class ClockInPageSkeleton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return UiShimmer(
|
||||
return const UiShimmer(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.only(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: UiConstants.space24,
|
||||
top: UiConstants.space6,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: UiConstants.space5,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: const <Widget>[
|
||||
children: <Widget>[
|
||||
// Date selector row
|
||||
DateSelectorSkeleton(),
|
||||
SizedBox(height: UiConstants.space5),
|
||||
|
||||
@@ -2,8 +2,6 @@ import 'package:core_localization/core_localization.dart';
|
||||
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 '../../bloc/geofence/geofence_bloc.dart';
|
||||
import '../../bloc/geofence/geofence_event.dart';
|
||||
|
||||
@@ -17,7 +17,7 @@ class HomeRepositoryImpl implements HomeRepository {
|
||||
@override
|
||||
Future<StaffDashboard> getDashboard() async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(V2ApiEndpoints.staffDashboard);
|
||||
await _apiService.get(StaffEndpoints.dashboard.path);
|
||||
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(V2ApiEndpoints.staffProfileCompletion);
|
||||
await _apiService.get(StaffEndpoints.profileCompletion.path);
|
||||
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(
|
||||
V2ApiEndpoints.staffPaymentsSummary,
|
||||
StaffEndpoints.paymentsSummary.path,
|
||||
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(
|
||||
V2ApiEndpoints.staffPaymentsHistory,
|
||||
StaffEndpoints.paymentsHistory.path,
|
||||
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(
|
||||
V2ApiEndpoints.staffPaymentsChart,
|
||||
StaffEndpoints.paymentsChart.path,
|
||||
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(V2ApiEndpoints.staffSession);
|
||||
await _api.get(StaffEndpoints.session.path);
|
||||
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(V2ApiEndpoints.staffProfileSections);
|
||||
await _api.get(StaffEndpoints.profileSections.path);
|
||||
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(V2ApiEndpoints.signOut);
|
||||
await _api.post(AuthEndpoints.signOut.path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class CertificatesRepositoryImpl implements CertificatesRepository {
|
||||
@override
|
||||
Future<List<StaffCertificate>> getCertificates() async {
|
||||
final ApiResponse response =
|
||||
await _api.get(V2ApiEndpoints.staffCertificates);
|
||||
await _api.get(StaffEndpoints.certificates.path);
|
||||
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(
|
||||
V2ApiEndpoints.staffCertificates,
|
||||
StaffEndpoints.certificates.path,
|
||||
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(
|
||||
V2ApiEndpoints.staffCertificateDelete(certificateId),
|
||||
StaffEndpoints.certificateDelete(certificateId).path,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class DocumentsRepositoryImpl implements DocumentsRepository {
|
||||
@override
|
||||
Future<List<ProfileDocument>> getDocuments() async {
|
||||
final ApiResponse response =
|
||||
await _api.get(V2ApiEndpoints.staffDocuments);
|
||||
await _api.get(StaffEndpoints.documents.path);
|
||||
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(
|
||||
V2ApiEndpoints.staffDocumentUpload(documentId),
|
||||
StaffEndpoints.documentUpload(documentId).path,
|
||||
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(V2ApiEndpoints.staffTaxForms);
|
||||
await _api.get(StaffEndpoints.taxForms.path);
|
||||
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(
|
||||
V2ApiEndpoints.staffTaxFormUpdate(form.formType),
|
||||
StaffEndpoints.taxFormUpdate(form.formType).path,
|
||||
data: form.toJson(),
|
||||
);
|
||||
}
|
||||
@@ -37,7 +37,7 @@ class TaxFormsRepositoryImpl implements TaxFormsRepository {
|
||||
@override
|
||||
Future<void> submitTaxForm(TaxForm form) async {
|
||||
await _api.post(
|
||||
V2ApiEndpoints.staffTaxFormSubmit(form.formType),
|
||||
StaffEndpoints.taxFormSubmit(form.formType).path,
|
||||
data: form.toJson(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ class BankAccountRepositoryImpl implements BankAccountRepository {
|
||||
@override
|
||||
Future<List<BankAccount>> getAccounts() async {
|
||||
final ApiResponse response =
|
||||
await _api.get(V2ApiEndpoints.staffBankAccounts);
|
||||
await _api.get(StaffEndpoints.bankAccounts.path);
|
||||
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(
|
||||
V2ApiEndpoints.staffBankAccounts,
|
||||
StaffEndpoints.bankAccounts.path,
|
||||
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(
|
||||
V2ApiEndpoints.staffTimeCard,
|
||||
StaffEndpoints.timeCard.path,
|
||||
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(V2ApiEndpoints.staffAttire);
|
||||
final ApiResponse response = await _api.get(StaffEndpoints.attire.path);
|
||||
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(
|
||||
V2ApiEndpoints.staffAttireUpload(itemId),
|
||||
StaffEndpoints.attireUpload(itemId).path,
|
||||
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(V2ApiEndpoints.staffEmergencyContacts);
|
||||
await _api.get(StaffEndpoints.emergencyContacts.path);
|
||||
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(
|
||||
V2ApiEndpoints.staffEmergencyContacts,
|
||||
StaffEndpoints.emergencyContacts.path,
|
||||
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(V2ApiEndpoints.staffIndustries);
|
||||
await _api.get(StaffEndpoints.industries.path);
|
||||
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(V2ApiEndpoints.staffSkills);
|
||||
final ApiResponse response = await _api.get(StaffEndpoints.skills.path);
|
||||
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(
|
||||
V2ApiEndpoints.staffPersonalInfo,
|
||||
StaffEndpoints.personalInfo.path,
|
||||
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(V2ApiEndpoints.staffPersonalInfo);
|
||||
await _api.get(StaffEndpoints.personalInfo.path);
|
||||
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(
|
||||
V2ApiEndpoints.staffPersonalInfo,
|
||||
StaffEndpoints.personalInfo.path,
|
||||
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(
|
||||
V2ApiEndpoints.staffProfilePhoto,
|
||||
StaffEndpoints.profilePhoto.path,
|
||||
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(V2ApiEndpoints.staffFaqs);
|
||||
await _apiService.get(StaffEndpoints.faqs.path);
|
||||
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(
|
||||
V2ApiEndpoints.staffFaqsSearch,
|
||||
StaffEndpoints.faqsSearch.path,
|
||||
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(V2ApiEndpoints.staffPrivacy);
|
||||
await _api.get(StaffEndpoints.privacy.path);
|
||||
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(
|
||||
V2ApiEndpoints.staffPrivacy,
|
||||
StaffEndpoints.privacy.path,
|
||||
data: <String, dynamic>{'profileVisible': isVisible},
|
||||
);
|
||||
return isVisible;
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'package:staff_shifts/src/domain/repositories/shifts_repository_interface
|
||||
|
||||
/// V2 API implementation of [ShiftsRepositoryInterface].
|
||||
///
|
||||
/// Uses [BaseApiService] with [V2ApiEndpoints] for all network access.
|
||||
/// Uses [BaseApiService] with [StaffEndpoints] for all network access.
|
||||
class ShiftsRepositoryImpl implements ShiftsRepositoryInterface {
|
||||
/// Creates a [ShiftsRepositoryImpl].
|
||||
ShiftsRepositoryImpl({required BaseApiService apiService})
|
||||
@@ -34,7 +34,7 @@ class ShiftsRepositoryImpl implements ShiftsRepositoryInterface {
|
||||
required DateTime end,
|
||||
}) async {
|
||||
final ApiResponse response = await _apiService.get(
|
||||
V2ApiEndpoints.staffShiftsAssigned,
|
||||
StaffEndpoints.shiftsAssigned.path,
|
||||
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(
|
||||
V2ApiEndpoints.staffShiftsOpen,
|
||||
StaffEndpoints.shiftsOpen.path,
|
||||
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(V2ApiEndpoints.staffShiftsPending);
|
||||
await _apiService.get(StaffEndpoints.shiftsPending.path);
|
||||
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(V2ApiEndpoints.staffShiftsCancelled);
|
||||
await _apiService.get(StaffEndpoints.shiftsCancelled.path);
|
||||
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(V2ApiEndpoints.staffShiftsCompleted);
|
||||
await _apiService.get(StaffEndpoints.shiftsCompleted.path);
|
||||
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(V2ApiEndpoints.staffShiftDetails(shiftId));
|
||||
await _apiService.get(StaffEndpoints.shiftDetails(shiftId).path);
|
||||
if (response.data == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -119,7 +119,7 @@ class ShiftsRepositoryImpl implements ShiftsRepositoryInterface {
|
||||
bool instantBook = false,
|
||||
}) async {
|
||||
await _apiService.post(
|
||||
V2ApiEndpoints.staffShiftApply(shiftId),
|
||||
StaffEndpoints.shiftApply(shiftId).path,
|
||||
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(V2ApiEndpoints.staffShiftAccept(shiftId));
|
||||
await _apiService.post(StaffEndpoints.shiftAccept(shiftId).path);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> declineShift(String shiftId) async {
|
||||
await _apiService.post(V2ApiEndpoints.staffShiftDecline(shiftId));
|
||||
await _apiService.post(StaffEndpoints.shiftDecline(shiftId).path);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> requestSwap(String shiftId, {String? reason}) async {
|
||||
await _apiService.post(
|
||||
V2ApiEndpoints.staffShiftRequestSwap(shiftId),
|
||||
StaffEndpoints.shiftRequestSwap(shiftId).path,
|
||||
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(V2ApiEndpoints.staffProfileCompletion);
|
||||
await _apiService.get(StaffEndpoints.profileCompletion.path);
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
final ProfileCompletion completion = ProfileCompletion.fromJson(data);
|
||||
return completion.completed;
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'package:krow_domain/krow_domain.dart';
|
||||
/// Contract for accessing shift-related data from the V2 API.
|
||||
///
|
||||
/// Implementations reside in the data layer and use [BaseApiService]
|
||||
/// with V2ApiEndpoints.
|
||||
/// with [StaffEndpoints].
|
||||
abstract interface class ShiftsRepositoryInterface {
|
||||
/// Retrieves assigned shifts for the current staff within a date range.
|
||||
Future<List<AssignedShift>> getAssignedShifts({
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import 'package:core_localization/core_localization.dart';
|
||||
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:intl/intl.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
import 'package:staff_shifts/src/presentation/blocs/shifts/shifts_bloc.dart';
|
||||
import 'package:staff_shifts/src/presentation/widgets/shared/empty_state_view.dart';
|
||||
|
||||
/// Tab showing open shifts available for the worker to browse and apply.
|
||||
|
||||
@@ -23,7 +23,7 @@ class StaffMainRepositoryImpl implements StaffMainRepositoryInterface {
|
||||
Future<bool> getProfileCompletion() async {
|
||||
try {
|
||||
final ApiResponse response = await _apiService.get(
|
||||
V2ApiEndpoints.staffProfileCompletion,
|
||||
StaffEndpoints.profileCompletion.path,
|
||||
);
|
||||
|
||||
if (response.data is Map<String, dynamic>) {
|
||||
|
||||
Reference in New Issue
Block a user