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

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

View File

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

View File

@@ -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(),
);
}

View File

@@ -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(),
);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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