Skip to content

Commit 870dec5

Browse files
committed
refactor(auth): adapt user creation to new preference models
Updates the `_ensureUserDataExists` method in `AuthService` to use the new `UserContentPreferences` constructor. This removes the deprecated `interests` field and adds the required `savedHeadlineFilters` and `savedSourceFilters` fields, ensuring new users are initialized with the correct data structure.
1 parent 8c3fea9 commit 870dec5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/src/services/auth_service.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,13 +558,15 @@ class AuthService {
558558
_log.info(
559559
'UserContentPreferences not found for user ${user.id}. Creating with defaults.',
560560
);
561+
// Initialize with empty lists for all user-managed content.
561562
final defaultUserPreferences = UserContentPreferences(
562563
id: user.id,
563564
followedCountries: const [],
564565
followedSources: const [],
565566
followedTopics: const [],
566567
savedHeadlines: const [],
567-
interests: const [],
568+
savedHeadlineFilters: const [],
569+
savedSourceFilters: const [],
568570
);
569571
await _userContentPreferencesRepository.create(
570572
item: defaultUserPreferences,

0 commit comments

Comments
 (0)