diff --git a/apps/mobile/packages/features/client/authentication/lib/src/data/repositories_impl/auth_repository_impl.dart b/apps/mobile/packages/features/client/authentication/lib/src/data/repositories_impl/auth_repository_impl.dart index c8fc50a3..908b57f2 100644 --- a/apps/mobile/packages/features/client/authentication/lib/src/data/repositories_impl/auth_repository_impl.dart +++ b/apps/mobile/packages/features/client/authentication/lib/src/data/repositories_impl/auth_repository_impl.dart @@ -190,7 +190,20 @@ class AuthRepositoryImpl implements AuthRepositoryInterface { envelope['business'] as Map?; if (businessJson != null) { - final ClientSession clientSession = ClientSession.fromJson(envelope); + // The auth envelope from buildAuthEnvelope uses `user.id` but + // ClientSession.fromJson expects `user.userId` (matching the shape + // returned by loadActorContext / GET /client/session). Normalise the + // key so the session is populated correctly. + final Map normalisedEnvelope = { + ...envelope, + if (userJson != null) + 'user': { + ...userJson, + 'userId': userJson['id'] ?? userJson['userId'], + }, + }; + final ClientSession clientSession = + ClientSession.fromJson(normalisedEnvelope); ClientSessionStore.instance.setSession(clientSession); } diff --git a/apps/mobile/packages/features/client/hubs/lib/src/data/repositories_impl/hub_repository_impl.dart b/apps/mobile/packages/features/client/hubs/lib/src/data/repositories_impl/hub_repository_impl.dart index 22b066d4..ea492685 100644 --- a/apps/mobile/packages/features/client/hubs/lib/src/data/repositories_impl/hub_repository_impl.dart +++ b/apps/mobile/packages/features/client/hubs/lib/src/data/repositories_impl/hub_repository_impl.dart @@ -142,11 +142,13 @@ class HubRepositoryImpl implements HubRepositoryInterface { required String hubId, required List businessMembershipIds, }) async { - await _apiService.post( - ClientEndpoints.hubAssignManagers(hubId), - data: { - 'businessMembershipIds': businessMembershipIds, - }, - ); + for (final String membershipId in businessMembershipIds) { + await _apiService.post( + ClientEndpoints.hubAssignManagers(hubId), + data: { + 'businessMembershipId': membershipId, + }, + ); + } } } diff --git a/apps/mobile/packages/features/client/orders/create_order/lib/src/data/repositories_impl/client_order_query_repository_impl.dart b/apps/mobile/packages/features/client/orders/create_order/lib/src/data/repositories_impl/client_order_query_repository_impl.dart index 967da1b6..5d32f51d 100644 --- a/apps/mobile/packages/features/client/orders/create_order/lib/src/data/repositories_impl/client_order_query_repository_impl.dart +++ b/apps/mobile/packages/features/client/orders/create_order/lib/src/data/repositories_impl/client_order_query_repository_impl.dart @@ -39,7 +39,7 @@ class ClientOrderQueryRepositoryImpl id: role['roleId'] as String? ?? role['id'] as String? ?? '', name: role['roleName'] as String? ?? role['name'] as String? ?? '', costPerHour: - ((role['billRateCents'] as num?)?.toDouble() ?? 0) / 100.0, + ((role['hourlyRateCents'] as num?)?.toDouble() ?? 0) / 100.0, ); }).toList(); }