feat: Update API endpoint usage in repositories to remove redundant path property
- Refactored multiple repository implementations across client and staff features to directly use endpoint objects without accessing the `path` property. - Introduced a new `FeatureGate` class for client-side feature gating based on user scopes, allowing for better access control to API endpoints. - Added `ApiEndpoint` class to represent API endpoints with their paths and required scopes for future feature gating.
This commit is contained in:
@@ -63,7 +63,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
|
||||
|
||||
try {
|
||||
final domain.ApiResponse startResponse = await _apiService.post(
|
||||
AuthEndpoints.staffPhoneStart.path,
|
||||
AuthEndpoints.staffPhoneStart,
|
||||
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(
|
||||
AuthEndpoints.staffPhoneVerify.path,
|
||||
AuthEndpoints.staffPhoneVerify,
|
||||
data: <String, dynamic>{
|
||||
'idToken': idToken,
|
||||
'mode': v2Mode,
|
||||
@@ -233,7 +233,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
|
||||
@override
|
||||
Future<void> signOut() async {
|
||||
try {
|
||||
await _apiService.post(AuthEndpoints.staffSignOut.path);
|
||||
await _apiService.post(AuthEndpoints.staffSignOut);
|
||||
} 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(
|
||||
StaffEndpoints.profileSetup.path,
|
||||
StaffEndpoints.profileSetup,
|
||||
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(
|
||||
StaffEndpoints.availability.path,
|
||||
StaffEndpoints.availability,
|
||||
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(
|
||||
StaffEndpoints.availability.path,
|
||||
StaffEndpoints.availability,
|
||||
data: <String, dynamic>{
|
||||
'dayOfWeek': dayOfWeek,
|
||||
'availabilityStatus': status.toJson(),
|
||||
@@ -86,7 +86,7 @@ class AvailabilityRepositoryImpl implements AvailabilityRepository {
|
||||
}
|
||||
|
||||
await _apiService.post(
|
||||
StaffEndpoints.availabilityQuickSet.path,
|
||||
StaffEndpoints.availabilityQuickSet,
|
||||
data: data,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ class ClockInRepositoryImpl implements ClockInRepositoryInterface {
|
||||
@override
|
||||
Future<List<Shift>> getTodaysShifts() async {
|
||||
final ApiResponse response = await _apiService.get(
|
||||
StaffEndpoints.clockInShiftsToday.path,
|
||||
StaffEndpoints.clockInShiftsToday,
|
||||
);
|
||||
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(
|
||||
StaffEndpoints.clockInStatus.path,
|
||||
StaffEndpoints.clockInStatus,
|
||||
);
|
||||
return AttendanceStatus.fromJson(response.data as Map<String, dynamic>);
|
||||
}
|
||||
@@ -44,7 +44,7 @@ class ClockInRepositoryImpl implements ClockInRepositoryInterface {
|
||||
String? notes,
|
||||
}) async {
|
||||
await _apiService.post(
|
||||
StaffEndpoints.clockIn.path,
|
||||
StaffEndpoints.clockIn,
|
||||
data: <String, dynamic>{
|
||||
'shiftId': shiftId,
|
||||
'sourceType': 'GEO',
|
||||
@@ -62,7 +62,7 @@ class ClockInRepositoryImpl implements ClockInRepositoryInterface {
|
||||
String? shiftId,
|
||||
}) async {
|
||||
await _apiService.post(
|
||||
StaffEndpoints.clockOut.path,
|
||||
StaffEndpoints.clockOut,
|
||||
data: <String, dynamic>{
|
||||
if (shiftId != null) 'shiftId': shiftId,
|
||||
'sourceType': 'GEO',
|
||||
|
||||
@@ -17,7 +17,7 @@ class HomeRepositoryImpl implements HomeRepository {
|
||||
@override
|
||||
Future<StaffDashboard> getDashboard() async {
|
||||
final ApiResponse response =
|
||||
await _apiService.get(StaffEndpoints.dashboard.path);
|
||||
await _apiService.get(StaffEndpoints.dashboard);
|
||||
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(StaffEndpoints.profileCompletion.path);
|
||||
await _apiService.get(StaffEndpoints.profileCompletion);
|
||||
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(
|
||||
StaffEndpoints.paymentsSummary.path,
|
||||
StaffEndpoints.paymentsSummary,
|
||||
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(
|
||||
StaffEndpoints.paymentsHistory.path,
|
||||
StaffEndpoints.paymentsHistory,
|
||||
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(
|
||||
StaffEndpoints.paymentsChart.path,
|
||||
StaffEndpoints.paymentsChart,
|
||||
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(StaffEndpoints.session.path);
|
||||
await _api.get(StaffEndpoints.session);
|
||||
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(StaffEndpoints.profileSections.path);
|
||||
await _api.get(StaffEndpoints.profileSections);
|
||||
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(AuthEndpoints.signOut.path);
|
||||
await _api.post(AuthEndpoints.signOut);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class CertificatesRepositoryImpl implements CertificatesRepository {
|
||||
@override
|
||||
Future<List<StaffCertificate>> getCertificates() async {
|
||||
final ApiResponse response =
|
||||
await _api.get(StaffEndpoints.certificates.path);
|
||||
await _api.get(StaffEndpoints.certificates);
|
||||
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(
|
||||
StaffEndpoints.certificates.path,
|
||||
StaffEndpoints.certificates,
|
||||
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(
|
||||
StaffEndpoints.certificateDelete(certificateId).path,
|
||||
StaffEndpoints.certificateDelete(certificateId),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class DocumentsRepositoryImpl implements DocumentsRepository {
|
||||
@override
|
||||
Future<List<ProfileDocument>> getDocuments() async {
|
||||
final ApiResponse response =
|
||||
await _api.get(StaffEndpoints.documents.path);
|
||||
await _api.get(StaffEndpoints.documents);
|
||||
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(
|
||||
StaffEndpoints.documentUpload(documentId).path,
|
||||
StaffEndpoints.documentUpload(documentId),
|
||||
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(StaffEndpoints.taxForms.path);
|
||||
await _api.get(StaffEndpoints.taxForms);
|
||||
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(
|
||||
StaffEndpoints.taxFormUpdate(form.formType).path,
|
||||
StaffEndpoints.taxFormUpdate(form.formType),
|
||||
data: form.toJson(),
|
||||
);
|
||||
}
|
||||
@@ -37,7 +37,7 @@ class TaxFormsRepositoryImpl implements TaxFormsRepository {
|
||||
@override
|
||||
Future<void> submitTaxForm(TaxForm form) async {
|
||||
await _api.post(
|
||||
StaffEndpoints.taxFormSubmit(form.formType).path,
|
||||
StaffEndpoints.taxFormSubmit(form.formType),
|
||||
data: form.toJson(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ class BankAccountRepositoryImpl implements BankAccountRepository {
|
||||
@override
|
||||
Future<List<BankAccount>> getAccounts() async {
|
||||
final ApiResponse response =
|
||||
await _api.get(StaffEndpoints.bankAccounts.path);
|
||||
await _api.get(StaffEndpoints.bankAccounts);
|
||||
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(
|
||||
StaffEndpoints.bankAccounts.path,
|
||||
StaffEndpoints.bankAccounts,
|
||||
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(
|
||||
StaffEndpoints.timeCard.path,
|
||||
StaffEndpoints.timeCard,
|
||||
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(StaffEndpoints.attire.path);
|
||||
final ApiResponse response = await _api.get(StaffEndpoints.attire);
|
||||
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(
|
||||
StaffEndpoints.attireUpload(itemId).path,
|
||||
StaffEndpoints.attireUpload(itemId),
|
||||
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(StaffEndpoints.emergencyContacts.path);
|
||||
await _api.get(StaffEndpoints.emergencyContacts);
|
||||
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(
|
||||
StaffEndpoints.emergencyContacts.path,
|
||||
StaffEndpoints.emergencyContacts,
|
||||
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(StaffEndpoints.industries.path);
|
||||
await _api.get(StaffEndpoints.industries);
|
||||
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(StaffEndpoints.skills.path);
|
||||
final ApiResponse response = await _api.get(StaffEndpoints.skills);
|
||||
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(
|
||||
StaffEndpoints.personalInfo.path,
|
||||
StaffEndpoints.personalInfo,
|
||||
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(StaffEndpoints.personalInfo.path);
|
||||
await _api.get(StaffEndpoints.personalInfo);
|
||||
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(
|
||||
StaffEndpoints.personalInfo.path,
|
||||
StaffEndpoints.personalInfo,
|
||||
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(
|
||||
StaffEndpoints.profilePhoto.path,
|
||||
StaffEndpoints.profilePhoto,
|
||||
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(StaffEndpoints.faqs.path);
|
||||
await _apiService.get(StaffEndpoints.faqs);
|
||||
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(
|
||||
StaffEndpoints.faqsSearch.path,
|
||||
StaffEndpoints.faqsSearch,
|
||||
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(StaffEndpoints.privacy.path);
|
||||
await _api.get(StaffEndpoints.privacy);
|
||||
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(
|
||||
StaffEndpoints.privacy.path,
|
||||
StaffEndpoints.privacy,
|
||||
data: <String, dynamic>{'profileVisible': isVisible},
|
||||
);
|
||||
return isVisible;
|
||||
|
||||
@@ -34,7 +34,7 @@ class ShiftsRepositoryImpl implements ShiftsRepositoryInterface {
|
||||
required DateTime end,
|
||||
}) async {
|
||||
final ApiResponse response = await _apiService.get(
|
||||
StaffEndpoints.shiftsAssigned.path,
|
||||
StaffEndpoints.shiftsAssigned,
|
||||
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(
|
||||
StaffEndpoints.shiftsOpen.path,
|
||||
StaffEndpoints.shiftsOpen,
|
||||
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(StaffEndpoints.shiftsPending.path);
|
||||
await _apiService.get(StaffEndpoints.shiftsPending);
|
||||
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(StaffEndpoints.shiftsCancelled.path);
|
||||
await _apiService.get(StaffEndpoints.shiftsCancelled);
|
||||
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(StaffEndpoints.shiftsCompleted.path);
|
||||
await _apiService.get(StaffEndpoints.shiftsCompleted);
|
||||
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(StaffEndpoints.shiftDetails(shiftId).path);
|
||||
await _apiService.get(StaffEndpoints.shiftDetails(shiftId));
|
||||
if (response.data == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -119,7 +119,7 @@ class ShiftsRepositoryImpl implements ShiftsRepositoryInterface {
|
||||
bool instantBook = false,
|
||||
}) async {
|
||||
await _apiService.post(
|
||||
StaffEndpoints.shiftApply(shiftId).path,
|
||||
StaffEndpoints.shiftApply(shiftId),
|
||||
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(StaffEndpoints.shiftAccept(shiftId).path);
|
||||
await _apiService.post(StaffEndpoints.shiftAccept(shiftId));
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> declineShift(String shiftId) async {
|
||||
await _apiService.post(StaffEndpoints.shiftDecline(shiftId).path);
|
||||
await _apiService.post(StaffEndpoints.shiftDecline(shiftId));
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> requestSwap(String shiftId, {String? reason}) async {
|
||||
await _apiService.post(
|
||||
StaffEndpoints.shiftRequestSwap(shiftId).path,
|
||||
StaffEndpoints.shiftRequestSwap(shiftId),
|
||||
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(StaffEndpoints.profileCompletion.path);
|
||||
await _apiService.get(StaffEndpoints.profileCompletion);
|
||||
final Map<String, dynamic> data = response.data as Map<String, dynamic>;
|
||||
final ProfileCompletion completion = ProfileCompletion.fromJson(data);
|
||||
return completion.completed;
|
||||
|
||||
@@ -23,7 +23,7 @@ class StaffMainRepositoryImpl implements StaffMainRepositoryInterface {
|
||||
Future<bool> getProfileCompletion() async {
|
||||
try {
|
||||
final ApiResponse response = await _apiService.get(
|
||||
StaffEndpoints.profileCompletion.path,
|
||||
StaffEndpoints.profileCompletion,
|
||||
);
|
||||
|
||||
if (response.data is Map<String, dynamic>) {
|
||||
|
||||
Reference in New Issue
Block a user