diff --git a/apps/mobile/packages/domain/lib/src/entities/users/staff_session.dart b/apps/mobile/packages/domain/lib/src/entities/users/staff_session.dart index a1b9e4de..dca4eeeb 100644 --- a/apps/mobile/packages/domain/lib/src/entities/users/staff_session.dart +++ b/apps/mobile/packages/domain/lib/src/entities/users/staff_session.dart @@ -61,7 +61,7 @@ class StaffSession extends Equatable { vendorId: staff['vendorId'] as String?, workforceNumber: staff['workforceNumber'] as String?, metadata: (staff['metadata'] as Map?) ?? const {}, - userId: user['userId'] as String?, + userId: (user['userId'] ?? user['id']) as String?, tenantName: tenant['tenantName'] as String?, tenantSlug: tenant['tenantSlug'] as String?, ); diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/data/repositories_impl/profile_setup_repository_impl.dart b/apps/mobile/packages/features/staff/authentication/lib/src/data/repositories_impl/profile_setup_repository_impl.dart index 2ca01e07..64a45151 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/data/repositories_impl/profile_setup_repository_impl.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/data/repositories_impl/profile_setup_repository_impl.dart @@ -1,3 +1,4 @@ +import 'package:firebase_auth/firebase_auth.dart'; import 'package:krow_core/core.dart'; import 'package:krow_domain/krow_domain.dart'; @@ -20,18 +21,32 @@ class ProfileSetupRepositoryImpl implements ProfileSetupRepository { @override Future submitProfile({ required String fullName, + required String phoneNumber, String? bio, required List preferredLocations, required double maxDistanceMiles, required List industries, required List skills, }) async { + // Convert location label strings to the object shape the V2 API expects. + // The backend zod schema requires: { label, city?, state?, ... }. + final List> locationObjects = preferredLocations + .map((String label) => {'label': label}) + .toList(); + + // Resolve the phone number: prefer the explicit parameter, but fall back + // to the Firebase Auth current user's phone if the caller passed empty. + final String resolvedPhone = phoneNumber.isNotEmpty + ? phoneNumber + : (FirebaseAuth.instance.currentUser?.phoneNumber ?? ''); + final ApiResponse response = await _apiService.post( StaffEndpoints.profileSetup, data: { 'fullName': fullName, + 'phoneNumber': resolvedPhone, if (bio != null && bio.isNotEmpty) 'bio': bio, - 'preferredLocations': preferredLocations, + 'preferredLocations': locationObjects, 'maxDistanceMiles': maxDistanceMiles.toInt(), 'industries': industries, 'skills': skills, diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/domain/repositories/profile_setup_repository.dart b/apps/mobile/packages/features/staff/authentication/lib/src/domain/repositories/profile_setup_repository.dart index 3c5b17c7..830f9a96 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/domain/repositories/profile_setup_repository.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/domain/repositories/profile_setup_repository.dart @@ -1,7 +1,9 @@ - +/// Interface for the staff profile setup repository. abstract class ProfileSetupRepository { + /// Submits the staff profile setup data to the backend. Future submitProfile({ required String fullName, + required String phoneNumber, String? bio, required List preferredLocations, required double maxDistanceMiles, diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/domain/usecases/submit_profile_setup_usecase.dart b/apps/mobile/packages/features/staff/authentication/lib/src/domain/usecases/submit_profile_setup_usecase.dart index f3a944ad..68a2a337 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/domain/usecases/submit_profile_setup_usecase.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/domain/usecases/submit_profile_setup_usecase.dart @@ -13,6 +13,7 @@ class SubmitProfileSetup { /// Submits the profile setup with the given data. Future call({ required String fullName, + required String phoneNumber, String? bio, required List preferredLocations, required double maxDistanceMiles, @@ -21,6 +22,7 @@ class SubmitProfileSetup { }) { return repository.submitProfile( fullName: fullName, + phoneNumber: phoneNumber, bio: bio, preferredLocations: preferredLocations, maxDistanceMiles: maxDistanceMiles, diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/blocs/profile_setup/profile_setup_bloc.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/blocs/profile_setup/profile_setup_bloc.dart index c35bb6e4..8f563aa6 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/blocs/profile_setup/profile_setup_bloc.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/blocs/profile_setup/profile_setup_bloc.dart @@ -12,11 +12,16 @@ export 'package:staff_authentication/src/presentation/blocs/profile_setup/profil class ProfileSetupBloc extends Bloc with BlocErrorHandler { /// Creates a [ProfileSetupBloc]. + /// + /// [phoneNumber] is the authenticated user's phone from the sign-up flow, + /// required by the V2 profile-setup endpoint. ProfileSetupBloc({ required SubmitProfileSetup submitProfileSetup, required SearchCitiesUseCase searchCities, + required String phoneNumber, }) : _submitProfileSetup = submitProfileSetup, _searchCities = searchCities, + _phoneNumber = phoneNumber, super(const ProfileSetupState()) { on(_onFullNameChanged); on(_onBioChanged); @@ -35,6 +40,9 @@ class ProfileSetupBloc extends Bloc /// The use case for searching cities. final SearchCitiesUseCase _searchCities; + /// The user's phone number from the sign-up flow. + final String _phoneNumber; + /// Handles the [ProfileSetupFullNameChanged] event. void _onFullNameChanged( ProfileSetupFullNameChanged event, @@ -95,6 +103,7 @@ class ProfileSetupBloc extends Bloc action: () async { await _submitProfileSetup( fullName: state.fullName, + phoneNumber: _phoneNumber, bio: state.bio.isEmpty ? null : state.bio, preferredLocations: state.preferredLocations, maxDistanceMiles: state.maxDistanceMiles, diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/staff_authentication_module.dart b/apps/mobile/packages/features/staff/authentication/lib/src/staff_authentication_module.dart index 0f0fabd4..cfaf7c81 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/staff_authentication_module.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/staff_authentication_module.dart @@ -56,6 +56,7 @@ class StaffAuthenticationModule extends Module { () => ProfileSetupBloc( submitProfileSetup: i.get(), searchCities: i.get(), + phoneNumber: i.get().state.phoneNumber, ), ); } diff --git a/apps/mobile/packages/features/staff/clock_in/lib/src/data/repositories_impl/clock_in_repository_impl.dart b/apps/mobile/packages/features/staff/clock_in/lib/src/data/repositories_impl/clock_in_repository_impl.dart index 96992d9b..3006a1ed 100644 --- a/apps/mobile/packages/features/staff/clock_in/lib/src/data/repositories_impl/clock_in_repository_impl.dart +++ b/apps/mobile/packages/features/staff/clock_in/lib/src/data/repositories_impl/clock_in_repository_impl.dart @@ -78,7 +78,7 @@ class ClockInRepositoryImpl implements ClockInRepositoryInterface { id: json['shiftId'] as String, orderId: json['orderId'] as String? ?? '', title: json['clientName'] as String? ?? json['roleName'] as String? ?? '', - status: ShiftStatus.fromJson(json['attendanceStatus'] as String?), + status: ShiftStatus.assigned, startsAt: DateTime.parse(json['startTime'] as String), endsAt: DateTime.parse(json['endTime'] as String), locationName: json['location'] as String?, diff --git a/apps/mobile/packages/features/staff/profile_sections/compliance/certificates/lib/src/data/repositories_impl/certificates_repository_impl.dart b/apps/mobile/packages/features/staff/profile_sections/compliance/certificates/lib/src/data/repositories_impl/certificates_repository_impl.dart index 60b45251..7de2157e 100644 --- a/apps/mobile/packages/features/staff/profile_sections/compliance/certificates/lib/src/data/repositories_impl/certificates_repository_impl.dart +++ b/apps/mobile/packages/features/staff/profile_sections/compliance/certificates/lib/src/data/repositories_impl/certificates_repository_impl.dart @@ -29,7 +29,7 @@ class CertificatesRepositoryImpl implements CertificatesRepository { final ApiResponse response = await _api.get(StaffEndpoints.certificates); final List items = - response.data['certificates'] as List? ?? []; + response.data['items'] as List? ?? []; return items .map((dynamic json) => StaffCertificate.fromJson(json as Map)) diff --git a/apps/mobile/packages/features/staff/profile_sections/compliance/documents/lib/src/data/repositories_impl/documents_repository_impl.dart b/apps/mobile/packages/features/staff/profile_sections/compliance/documents/lib/src/data/repositories_impl/documents_repository_impl.dart index 56ade1eb..929cfd35 100644 --- a/apps/mobile/packages/features/staff/profile_sections/compliance/documents/lib/src/data/repositories_impl/documents_repository_impl.dart +++ b/apps/mobile/packages/features/staff/profile_sections/compliance/documents/lib/src/data/repositories_impl/documents_repository_impl.dart @@ -28,7 +28,7 @@ class DocumentsRepositoryImpl implements DocumentsRepository { Future> getDocuments() async { final ApiResponse response = await _api.get(StaffEndpoints.documents); - final List items = response.data['documents'] as List? ?? []; + final List items = response.data['items'] as List? ?? []; return items .map((dynamic json) => ProfileDocument.fromJson(json as Map)) diff --git a/apps/mobile/packages/features/staff/profile_sections/compliance/tax_forms/lib/src/data/repositories/tax_forms_repository_impl.dart b/apps/mobile/packages/features/staff/profile_sections/compliance/tax_forms/lib/src/data/repositories/tax_forms_repository_impl.dart index 6145e964..23984b22 100644 --- a/apps/mobile/packages/features/staff/profile_sections/compliance/tax_forms/lib/src/data/repositories/tax_forms_repository_impl.dart +++ b/apps/mobile/packages/features/staff/profile_sections/compliance/tax_forms/lib/src/data/repositories/tax_forms_repository_impl.dart @@ -19,7 +19,7 @@ class TaxFormsRepositoryImpl implements TaxFormsRepository { Future> getTaxForms() async { final ApiResponse response = await _api.get(StaffEndpoints.taxForms); - final List items = response.data['taxForms'] as List? ?? []; + final List items = response.data['items'] as List? ?? []; return items .map((dynamic json) => TaxForm.fromJson(json as Map)) diff --git a/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/lib/src/data/repositories/bank_account_repository_impl.dart b/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/lib/src/data/repositories/bank_account_repository_impl.dart index bc387187..daf7d393 100644 --- a/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/lib/src/data/repositories/bank_account_repository_impl.dart +++ b/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/lib/src/data/repositories/bank_account_repository_impl.dart @@ -1,6 +1,7 @@ import 'package:krow_core/core.dart'; import 'package:krow_domain/krow_domain.dart'; +import 'package:staff_bank_account/src/domain/arguments/add_bank_account_params.dart'; import 'package:staff_bank_account/src/domain/repositories/bank_account_repository.dart'; /// Implementation of [BankAccountRepository] using the V2 API. @@ -17,7 +18,7 @@ class BankAccountRepositoryImpl implements BankAccountRepository { Future> getAccounts() async { final ApiResponse response = await _api.get(StaffEndpoints.bankAccounts); - final List items = response.data['accounts'] as List? ?? []; + final List items = response.data['items'] as List? ?? []; return items .map((dynamic json) => BankAccount.fromJson(json as Map)) @@ -25,10 +26,10 @@ class BankAccountRepositoryImpl implements BankAccountRepository { } @override - Future addAccount(BankAccount account) async { + Future addAccount(AddBankAccountParams params) async { await _api.post( StaffEndpoints.bankAccounts, - data: account.toJson(), + data: params.toJson(), ); } } diff --git a/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/lib/src/domain/arguments/add_bank_account_params.dart b/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/lib/src/domain/arguments/add_bank_account_params.dart index 3a6aa13a..70fa1ad2 100644 --- a/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/lib/src/domain/arguments/add_bank_account_params.dart +++ b/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/lib/src/domain/arguments/add_bank_account_params.dart @@ -1,16 +1,44 @@ -import 'package:equatable/equatable.dart'; import 'package:krow_core/core.dart'; -import 'package:krow_domain/krow_domain.dart'; +import 'package:krow_domain/krow_domain.dart' show AccountType; -/// Arguments for adding a bank account. -class AddBankAccountParams extends UseCaseArgument with EquatableMixin { +/// Parameters for creating a new bank account via the V2 API. +/// +/// Maps directly to the `bankAccountCreateSchema` zod schema: +/// `{ bankName, accountNumber, routingNumber, accountType }`. +class AddBankAccountParams extends UseCaseArgument { + /// Creates an [AddBankAccountParams]. + const AddBankAccountParams({ + required this.bankName, + required this.accountNumber, + required this.routingNumber, + required this.accountType, + }); - const AddBankAccountParams({required this.account}); - final BankAccount account; + /// Name of the bank / financial institution. + final String bankName; + + /// Full account number. + final String accountNumber; + + /// Routing / transit number. + final String routingNumber; + + /// Account type (checking or savings). + final AccountType accountType; + + /// Serialises to the V2 API request body. + Map toJson() => { + 'bankName': bankName, + 'accountNumber': accountNumber, + 'routingNumber': routingNumber, + 'accountType': accountType.toJson(), + }; @override - List get props => [account]; - - @override - bool? get stringify => true; + List get props => [ + bankName, + accountNumber, + routingNumber, + accountType, + ]; } diff --git a/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/lib/src/domain/repositories/bank_account_repository.dart b/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/lib/src/domain/repositories/bank_account_repository.dart index 21e68e73..faecb774 100644 --- a/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/lib/src/domain/repositories/bank_account_repository.dart +++ b/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/lib/src/domain/repositories/bank_account_repository.dart @@ -1,12 +1,12 @@ -import 'package:krow_domain/krow_domain.dart'; +import 'package:krow_domain/krow_domain.dart' show BankAccount; + +import '../arguments/add_bank_account_params.dart'; /// Repository interface for managing bank accounts. -/// -/// Uses [BankAccount] from the V2 domain layer. abstract class BankAccountRepository { /// Fetches the list of bank accounts for the current staff member. Future> getAccounts(); - /// Adds a new bank account. - Future addAccount(BankAccount account); + /// Creates a new bank account with the given [params]. + Future addAccount(AddBankAccountParams params); } diff --git a/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/lib/src/domain/usecases/add_bank_account_usecase.dart b/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/lib/src/domain/usecases/add_bank_account_usecase.dart index 2403b32d..840637ed 100644 --- a/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/lib/src/domain/usecases/add_bank_account_usecase.dart +++ b/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/lib/src/domain/usecases/add_bank_account_usecase.dart @@ -1,15 +1,17 @@ import 'package:krow_core/core.dart'; -import '../repositories/bank_account_repository.dart'; + import '../arguments/add_bank_account_params.dart'; +import '../repositories/bank_account_repository.dart'; /// Use case to add a bank account. class AddBankAccountUseCase implements UseCase { - + /// Creates an [AddBankAccountUseCase]. AddBankAccountUseCase(this._repository); + final BankAccountRepository _repository; @override Future call(AddBankAccountParams params) { - return _repository.addAccount(params.account); + return _repository.addAccount(params); } } diff --git a/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/lib/src/presentation/blocs/bank_account_cubit.dart b/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/lib/src/presentation/blocs/bank_account_cubit.dart index 70ee70ce..e041aefa 100644 --- a/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/lib/src/presentation/blocs/bank_account_cubit.dart +++ b/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/lib/src/presentation/blocs/bank_account_cubit.dart @@ -1,6 +1,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:krow_core/core.dart'; -import 'package:krow_domain/krow_domain.dart'; +import 'package:krow_domain/krow_domain.dart' show AccountType, BankAccount; + import '../../domain/arguments/add_bank_account_params.dart'; import '../../domain/usecases/add_bank_account_usecase.dart'; import '../../domain/usecases/get_bank_accounts_usecase.dart'; @@ -47,15 +48,10 @@ class BankAccountCubit extends Cubit }) async { emit(state.copyWith(status: BankAccountStatus.loading)); - // Create domain entity - final BankAccount newAccount = BankAccount( - accountId: '', // Generated by server + final AddBankAccountParams params = AddBankAccountParams( bankName: bankName, - providerReference: routingNumber, - last4: accountNumber.length > 4 - ? accountNumber.substring(accountNumber.length - 4) - : accountNumber, - isPrimary: false, + accountNumber: accountNumber, + routingNumber: routingNumber, accountType: type == 'CHECKING' ? AccountType.checking : AccountType.savings, @@ -64,7 +60,7 @@ class BankAccountCubit extends Cubit await handleError( emit: emit, action: () async { - await _addBankAccountUseCase(AddBankAccountParams(account: newAccount)); + await _addBankAccountUseCase(params); // Re-fetch to get latest state including server-generated IDs await loadAccounts(); diff --git a/apps/mobile/packages/features/staff/profile_sections/finances/time_card/lib/src/data/repositories_impl/time_card_repository_impl.dart b/apps/mobile/packages/features/staff/profile_sections/finances/time_card/lib/src/data/repositories_impl/time_card_repository_impl.dart index cd103430..3dda95a0 100644 --- a/apps/mobile/packages/features/staff/profile_sections/finances/time_card/lib/src/data/repositories_impl/time_card_repository_impl.dart +++ b/apps/mobile/packages/features/staff/profile_sections/finances/time_card/lib/src/data/repositories_impl/time_card_repository_impl.dart @@ -22,7 +22,7 @@ class TimeCardRepositoryImpl implements TimeCardRepository { 'month': month.month, }, ); - final List items = response.data['entries'] as List? ?? []; + final List items = response.data['items'] as List? ?? []; return items .map((dynamic json) => TimeCardEntry.fromJson(json as Map)) diff --git a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/data/repositories/emergency_contact_repository_impl.dart b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/data/repositories/emergency_contact_repository_impl.dart index a60c8928..d20f61eb 100644 --- a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/data/repositories/emergency_contact_repository_impl.dart +++ b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/data/repositories/emergency_contact_repository_impl.dart @@ -18,7 +18,8 @@ class EmergencyContactRepositoryImpl Future> getContacts() async { final ApiResponse response = await _api.get(StaffEndpoints.emergencyContacts); - final List items = response.data['contacts'] as List? ?? []; + final List items = + response.data['items'] as List? ?? []; return items .map((dynamic json) => EmergencyContact.fromJson(json as Map)) @@ -27,12 +28,27 @@ class EmergencyContactRepositoryImpl @override Future saveContacts(List contacts) async { - await _api.post( - StaffEndpoints.emergencyContacts, - data: { - 'contacts': - contacts.map((EmergencyContact c) => c.toJson()).toList(), - }, - ); + for (final EmergencyContact contact in contacts) { + final Map body = { + 'fullName': contact.fullName, + 'phone': contact.phone, + 'relationshipType': contact.relationshipType, + 'isPrimary': contact.isPrimary, + }; + + if (contact.contactId.isNotEmpty) { + // Existing contact — update via PUT. + await _api.put( + StaffEndpoints.emergencyContactUpdate(contact.contactId), + data: body, + ); + } else { + // New contact — create via POST. + await _api.post( + StaffEndpoints.emergencyContacts, + data: body, + ); + } + } } } diff --git a/apps/mobile/packages/features/staff/profile_sections/onboarding/profile_info/lib/src/data/repositories/personal_info_repository_impl.dart b/apps/mobile/packages/features/staff/profile_sections/onboarding/profile_info/lib/src/data/repositories/personal_info_repository_impl.dart index 75fc0a01..5cba61fc 100644 --- a/apps/mobile/packages/features/staff/profile_sections/onboarding/profile_info/lib/src/data/repositories/personal_info_repository_impl.dart +++ b/apps/mobile/packages/features/staff/profile_sections/onboarding/profile_info/lib/src/data/repositories/personal_info_repository_impl.dart @@ -1,3 +1,4 @@ +import 'package:dio/dio.dart'; import 'package:krow_core/core.dart'; import 'package:krow_domain/krow_domain.dart'; @@ -10,20 +11,12 @@ import 'package:staff_profile_info/src/domain/repositories/personal_info_reposit class PersonalInfoRepositoryImpl implements PersonalInfoRepositoryInterface { /// Creates a [PersonalInfoRepositoryImpl]. /// - /// Requires the V2 [BaseApiService] for HTTP communication, - /// [FileUploadService] for uploading files to cloud storage, and - /// [SignedUrlService] for generating signed download URLs. + /// Requires the V2 [BaseApiService] for HTTP communication. PersonalInfoRepositoryImpl({ required BaseApiService apiService, - required FileUploadService uploadService, - required SignedUrlService signedUrlService, - }) : _api = apiService, - _uploadService = uploadService, - _signedUrlService = signedUrlService; + }) : _api = apiService; final BaseApiService _api; - final FileUploadService _uploadService; - final SignedUrlService _signedUrlService; @override Future getStaffProfile() async { @@ -39,39 +32,34 @@ class PersonalInfoRepositoryImpl implements PersonalInfoRepositoryInterface { required String staffId, required Map data, }) async { - final ApiResponse response = await _api.put( + // The PUT response returns { staffId, fullName, email, phone, metadata } + // which does not match the StaffPersonalInfo shape. Perform the update + // and then re-fetch the full profile to return the correct entity. + await _api.put( StaffEndpoints.personalInfo, data: data, ); - final Map json = - response.data as Map; - return StaffPersonalInfo.fromJson(json); + return getStaffProfile(); } @override Future uploadProfilePhoto(String filePath) async { - // 1. Upload the file to cloud storage. - final FileUploadResponse uploadRes = await _uploadService.uploadFile( - filePath: filePath, - fileName: - 'staff_profile_photo_${DateTime.now().millisecondsSinceEpoch}.jpg', - visibility: FileVisibility.public, - ); + // The backend expects a multipart file upload at /staff/profile/photo. + // It uploads to GCS, updates staff metadata, and returns a signed URL. + final String fileName = + 'staff_profile_photo_${DateTime.now().millisecondsSinceEpoch}.jpg'; + final FormData formData = FormData.fromMap({ + 'file': await MultipartFile.fromFile(filePath, filename: fileName), + }); - // 2. Generate a signed URL for the uploaded file. - final SignedUrlResponse signedUrlRes = - await _signedUrlService.createSignedUrl(fileUri: uploadRes.fileUri); - final String photoUrl = signedUrlRes.signedUrl; - - // 3. Submit the photo URL to the V2 API. - await _api.post( + final ApiResponse response = await _api.post( StaffEndpoints.profilePhoto, - data: { - 'fileUri': uploadRes.fileUri, - 'photoUrl': photoUrl, - }, + data: formData, ); + final Map json = + response.data as Map; - return photoUrl; + // Backend returns { staffId, fileUri, signedUrl, expiresAt }. + return json['signedUrl'] as String? ?? ''; } } diff --git a/apps/mobile/packages/features/staff/profile_sections/onboarding/profile_info/lib/src/staff_profile_info_module.dart b/apps/mobile/packages/features/staff/profile_sections/onboarding/profile_info/lib/src/staff_profile_info_module.dart index c7a47872..37336302 100644 --- a/apps/mobile/packages/features/staff/profile_sections/onboarding/profile_info/lib/src/staff_profile_info_module.dart +++ b/apps/mobile/packages/features/staff/profile_sections/onboarding/profile_info/lib/src/staff_profile_info_module.dart @@ -27,8 +27,6 @@ class StaffProfileInfoModule extends Module { i.addLazySingleton( () => PersonalInfoRepositoryImpl( apiService: i.get(), - uploadService: i.get(), - signedUrlService: i.get(), ), ); diff --git a/apps/mobile/packages/features/staff/profile_sections/onboarding/profile_info/pubspec.yaml b/apps/mobile/packages/features/staff/profile_sections/onboarding/profile_info/pubspec.yaml index e8c7b321..ed42fef5 100644 --- a/apps/mobile/packages/features/staff/profile_sections/onboarding/profile_info/pubspec.yaml +++ b/apps/mobile/packages/features/staff/profile_sections/onboarding/profile_info/pubspec.yaml @@ -14,6 +14,7 @@ dependencies: flutter_bloc: ^8.1.0 bloc: ^8.1.0 flutter_modular: ^6.3.0 + dio: ^5.9.1 equatable: ^2.0.5 # Architecture Packages diff --git a/apps/mobile/packages/features/staff/shifts/lib/src/data/repositories_impl/shifts_repository_impl.dart b/apps/mobile/packages/features/staff/shifts/lib/src/data/repositories_impl/shifts_repository_impl.dart index ee27ea03..8835d825 100644 --- a/apps/mobile/packages/features/staff/shifts/lib/src/data/repositories_impl/shifts_repository_impl.dart +++ b/apps/mobile/packages/features/staff/shifts/lib/src/data/repositories_impl/shifts_repository_impl.dart @@ -96,12 +96,10 @@ class ShiftsRepositoryImpl implements ShiftsRepositoryInterface { final ApiResponse response = await _apiService.get(StaffEndpoints.shiftsCompleted); final List items = _extractItems(response.data); - var x = items + return items .map((dynamic json) => CompletedShift.fromJson(json as Map)) .toList(); - - return x; } @override