Refactor API endpoint usage across multiple repositories to use ClientEndpoints and StaffEndpoints

- Updated ClientOrderQueryRepositoryImpl to replace V2ApiEndpoints with ClientEndpoints for vendor, role, hub, and manager retrieval methods.
- Modified ViewOrdersRepositoryImpl to utilize ClientEndpoints for order viewing, editing, and vendor retrieval.
- Refactored ReportsRepositoryImpl to switch from V2ApiEndpoints to ClientEndpoints for various report fetching methods.
- Changed SettingsRepositoryImpl to use AuthEndpoints for sign-out functionality.
- Adjusted AuthRepositoryImpl to replace V2ApiEndpoints with AuthEndpoints for phone authentication and sign-out processes.
- Updated ProfileSetupRepositoryImpl to utilize StaffEndpoints for profile setup.
- Refactored AvailabilityRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for availability management.
- Changed ClockInRepositoryImpl to use StaffEndpoints for clock-in and clock-out functionalities.
- Updated HomeRepositoryImpl to replace V2ApiEndpoints with StaffEndpoints for dashboard and profile completion retrieval.
- Refactored PaymentsRepositoryImpl to utilize StaffEndpoints for payment summaries and history.
- Changed ProfileRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for staff profile and section status retrieval.
- Updated CertificatesRepositoryImpl to use StaffEndpoints for certificate management.
- Refactored DocumentsRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for document management.
- Changed TaxFormsRepositoryImpl to utilize StaffEndpoints for tax form management.
- Updated BankAccountRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for bank account management.
- Refactored TimeCardRepositoryImpl to use StaffEndpoints for time card retrieval.
- Changed AttireRepositoryImpl to utilize StaffEndpoints for attire management.
- Updated EmergencyContactRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for emergency contact management.
- Refactored ExperienceRepositoryImpl to use StaffEndpoints for industry and skill retrieval.
- Changed PersonalInfoRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for personal information management.
- Updated FaqsRepositoryImpl to utilize StaffEndpoints for FAQs retrieval.
- Refactored PrivacySettingsRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for privacy settings management.
- Changed ShiftsRepositoryImpl to use StaffEndpoints for shift management and retrieval.
- Updated StaffMainRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for profile completion checks.
This commit is contained in:
Achintha Isuru
2026-03-17 11:40:15 -04:00
parent 31231c1e6d
commit 57bba8ab4e
46 changed files with 134 additions and 544 deletions

View File

@@ -5,7 +5,7 @@ import 'package: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',

View File

@@ -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),

View File

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