Skip to content

Commit c6877bc

Browse files
committed
refactor(auth): use readAll with filter in AuthService
- Replaces the obsolete `readAllByQuery` method with the new `readAll` method in `AuthService`. - Passes the query conditions as a `filter` map, aligning the service with the new document-based data access pattern. - This change completes the service-level refactoring for the MongoDB migration.
1 parent bf6f59d commit c6877bc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/src/services/auth_service.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,9 @@ class AuthService {
411411

412412
try {
413413
// 1. Check if emailToLink is already used by another permanent user.
414-
final query = {'email': emailToLink};
415-
final existingUsersResponse = await _userRepository.readAllByQuery(query);
414+
final existingUsersResponse = await _userRepository.readAll(
415+
filter: {'email': emailToLink},
416+
);
416417

417418
// Filter for permanent users (not guests) that are not the current user.
418419
final conflictingPermanentUsers = existingUsersResponse.items.where(
@@ -612,8 +613,9 @@ class AuthService {
612613
/// Re-throws any [HtHttpException] from the repository.
613614
Future<User?> _findUserByEmail(String email) async {
614615
try {
615-
final query = {'email': email};
616-
final response = await _userRepository.readAllByQuery(query);
616+
final response = await _userRepository.readAll(
617+
filter: {'email': email},
618+
);
617619
if (response.items.isNotEmpty) {
618620
return response.items.first;
619621
}

0 commit comments

Comments
 (0)