@@ -38,24 +38,40 @@ class AppDependencies {
38
38
final _completer = Completer <void >();
39
39
40
40
// --- Repositories ---
41
+ /// A repository for managing [Headline] data.
41
42
late final HtDataRepository <Headline > headlineRepository;
43
+ /// A repository for managing [Topic] data.
42
44
late final HtDataRepository <Topic > topicRepository;
45
+ /// A repository for managing [Source] data.
43
46
late final HtDataRepository <Source > sourceRepository;
47
+ /// A repository for managing [Country] data.
44
48
late final HtDataRepository <Country > countryRepository;
49
+ /// A repository for managing [User] data.
45
50
late final HtDataRepository <User > userRepository;
51
+ /// A repository for managing [UserAppSettings] data.
46
52
late final HtDataRepository <UserAppSettings > userAppSettingsRepository;
53
+ /// A repository for managing [UserContentPreferences] data.
47
54
late final HtDataRepository <UserContentPreferences >
48
55
userContentPreferencesRepository;
56
+ /// A repository for managing the global [RemoteConfig] data.
49
57
late final HtDataRepository <RemoteConfig > remoteConfigRepository;
50
58
51
59
// --- Services ---
60
+ /// A service for sending emails.
52
61
late final HtEmailRepository emailRepository;
62
+ /// A service for managing a blacklist of invalidated authentication tokens.
53
63
late final TokenBlacklistService tokenBlacklistService;
64
+ /// A service for generating and validating authentication tokens.
54
65
late final AuthTokenService authTokenService;
66
+ /// A service for storing and validating one-time verification codes.
55
67
late final VerificationCodeStorageService verificationCodeStorageService;
68
+ /// A service that orchestrates authentication logic.
56
69
late final AuthService authService;
70
+ /// A service for calculating and providing a summary for the dashboard.
57
71
late final DashboardSummaryService dashboardSummaryService;
72
+ /// A service for checking user permissions.
58
73
late final PermissionService permissionService;
74
+ /// A service for enforcing limits on user content preferences.
59
75
late final UserPreferenceLimitService userPreferenceLimitService;
60
76
61
77
/// Initializes all application dependencies.
@@ -104,18 +120,13 @@ class AppDependencies {
104
120
// columns. The Headline.fromJson factory expects ISO 8601 strings.
105
121
// This handler converts them before deserialization.
106
122
(json) => Headline .fromJson (_convertTimestampsToString (json)),
107
- (headline) {
108
- final json = headline.toJson ();
109
- // The database expects foreign key IDs, not nested objects.
110
- // We extract the IDs and remove the original objects.
111
- json['source_id' ] = headline.source.id;
112
- json['topic_id' ] = headline.topic.id;
113
- json['event_country_id' ] = headline.eventCountry.id;
114
- json.remove ('source' );
115
- json.remove ('topic' );
116
- json.remove ('eventCountry' );
117
- return json;
118
- },
123
+ (headline) => headline.toJson ()
124
+ ..['source_id' ] = headline.source.id
125
+ ..['topic_id' ] = headline.topic.id
126
+ ..['event_country_id' ] = headline.eventCountry.id
127
+ ..remove ('source' )
128
+ ..remove ('topic' )
129
+ ..remove ('eventCountry' ),
119
130
);
120
131
topicRepository = _createRepository (
121
132
connection,
@@ -127,13 +138,9 @@ class AppDependencies {
127
138
connection,
128
139
'sources' ,
129
140
(json) => Source .fromJson (_convertTimestampsToString (json)),
130
- (source) {
131
- final json = source.toJson ();
132
- // The database expects headquarters_country_id, not a nested object.
133
- json['headquarters_country_id' ] = source.headquarters.id;
134
- json.remove ('headquarters' );
135
- return json;
136
- },
141
+ (source) => source.toJson ()
142
+ ..['headquarters_country_id' ] = source.headquarters.id
143
+ ..remove ('headquarters' ),
137
144
);
138
145
countryRepository = _createRepository (
139
146
connection,
@@ -158,7 +165,7 @@ class AppDependencies {
158
165
userAppSettingsRepository = _createRepository (
159
166
connection,
160
167
'user_app_settings' ,
161
- UserAppSettings .fromJson,
168
+ (json) => UserAppSettings .fromJson (json) ,
162
169
(settings) {
163
170
final json = settings.toJson ();
164
171
// These fields are complex objects and must be JSON encoded for the DB.
@@ -170,7 +177,7 @@ class AppDependencies {
170
177
userContentPreferencesRepository = _createRepository (
171
178
connection,
172
179
'user_content_preferences' ,
173
- UserContentPreferences .fromJson,
180
+ (json) => UserContentPreferences .fromJson (json) ,
174
181
(preferences) {
175
182
final json = preferences.toJson ();
176
183
// These fields are lists of complex objects and must be JSON encoded.
0 commit comments