@@ -113,8 +113,9 @@ Future<Response> _handleGet(
113
113
114
114
final specificQueryForClient = < String , String > {};
115
115
final Set <String > allowedKeys;
116
- final receivedKeys =
117
- queryParams.keys.where ((k) => k != 'model' && k != 'startAfterId' && k != 'limit' ).toSet ();
116
+ final receivedKeys = queryParams.keys
117
+ .where ((k) => k != 'model' && k != 'startAfterId' && k != 'limit' )
118
+ .toSet ();
118
119
119
120
switch (modelName) {
120
121
case 'headline' :
@@ -131,7 +132,6 @@ Future<Response> _handleGet(
131
132
specificQueryForClient['source.id_in' ] = queryParams['sources' ]! ;
132
133
}
133
134
}
134
- break ;
135
135
case 'source' :
136
136
allowedKeys = {'countries' , 'sourceTypes' , 'languages' , 'q' };
137
137
final qValue = queryParams['q' ];
@@ -140,32 +140,32 @@ Future<Response> _handleGet(
140
140
specificQueryForClient['description_contains' ] = qValue;
141
141
} else {
142
142
if (queryParams.containsKey ('countries' )) {
143
- specificQueryForClient['headquarters.iso_code_in' ] = queryParams['countries' ]! ;
143
+ specificQueryForClient['headquarters.iso_code_in' ] =
144
+ queryParams['countries' ]! ;
144
145
}
145
146
if (queryParams.containsKey ('sourceTypes' )) {
146
- specificQueryForClient['source_type_in' ] = queryParams['sourceTypes' ]! ;
147
+ specificQueryForClient['source_type_in' ] =
148
+ queryParams['sourceTypes' ]! ;
147
149
}
148
150
if (queryParams.containsKey ('languages' )) {
149
151
specificQueryForClient['language_in' ] = queryParams['languages' ]! ;
150
152
}
151
153
}
152
- break ;
153
154
case 'category' :
154
155
allowedKeys = {'q' };
155
156
final qValue = queryParams['q' ];
156
157
if (qValue != null && qValue.isNotEmpty) {
157
158
specificQueryForClient['name_contains' ] = qValue;
158
159
specificQueryForClient['description_contains' ] = qValue;
159
160
}
160
- break ;
161
161
case 'country' :
162
162
allowedKeys = {'q' };
163
163
final qValue = queryParams['q' ];
164
164
if (qValue != null && qValue.isNotEmpty) {
165
165
specificQueryForClient['name_contains' ] = qValue;
166
- specificQueryForClient['iso_code_contains' ] = qValue; // Also search iso_code
166
+ specificQueryForClient['iso_code_contains' ] =
167
+ qValue; // Also search iso_code
167
168
}
168
- break ;
169
169
default :
170
170
// For other models, pass through all non-standard query params directly.
171
171
// No specific validation of allowed keys for these other models here.
@@ -176,7 +176,6 @@ Future<Response> _handleGet(
176
176
specificQueryForClient[key] = value;
177
177
}
178
178
});
179
- break ;
180
179
}
181
180
182
181
// Validate received keys against allowed keys for the specific models
@@ -195,7 +194,9 @@ Future<Response> _handleGet(
195
194
}
196
195
197
196
PaginatedResponse <dynamic > paginatedResponse;
198
- String ? userIdForRepoCall = modelConfig.getOwnerId != null ? authenticatedUser.id : null ;
197
+ // ignore: prefer_final_locals
198
+ var userIdForRepoCall =
199
+ modelConfig.getOwnerId != null ? authenticatedUser.id : null ;
199
200
200
201
// Repository calls using specificQueryForClient
201
202
switch (modelName) {
@@ -207,7 +208,6 @@ Future<Response> _handleGet(
207
208
startAfterId: startAfterId,
208
209
limit: limit,
209
210
);
210
- break ;
211
211
case 'category' :
212
212
final repo = context.read <HtDataRepository <Category >>();
213
213
paginatedResponse = await repo.readAllByQuery (
@@ -216,7 +216,6 @@ Future<Response> _handleGet(
216
216
startAfterId: startAfterId,
217
217
limit: limit,
218
218
);
219
- break ;
220
219
case 'source' :
221
220
final repo = context.read <HtDataRepository <Source >>();
222
221
paginatedResponse = await repo.readAllByQuery (
@@ -225,7 +224,6 @@ Future<Response> _handleGet(
225
224
startAfterId: startAfterId,
226
225
limit: limit,
227
226
);
228
- break ;
229
227
case 'country' :
230
228
final repo = context.read <HtDataRepository <Country >>();
231
229
paginatedResponse = await repo.readAllByQuery (
@@ -234,7 +232,6 @@ Future<Response> _handleGet(
234
232
startAfterId: startAfterId,
235
233
limit: limit,
236
234
);
237
- break ;
238
235
case 'user' :
239
236
final repo = context.read <HtDataRepository <User >>();
240
237
paginatedResponse = await repo.readAllByQuery (
@@ -243,7 +240,6 @@ Future<Response> _handleGet(
243
240
startAfterId: startAfterId,
244
241
limit: limit,
245
242
);
246
- break ;
247
243
case 'user_app_settings' :
248
244
final repo = context.read <HtDataRepository <UserAppSettings >>();
249
245
paginatedResponse = await repo.readAllByQuery (
@@ -252,7 +248,6 @@ Future<Response> _handleGet(
252
248
startAfterId: startAfterId,
253
249
limit: limit,
254
250
);
255
- break ;
256
251
case 'user_content_preferences' :
257
252
final repo = context.read <HtDataRepository <UserContentPreferences >>();
258
253
paginatedResponse = await repo.readAllByQuery (
@@ -261,7 +256,6 @@ Future<Response> _handleGet(
261
256
startAfterId: startAfterId,
262
257
limit: limit,
263
258
);
264
- break ;
265
259
case 'app_config' :
266
260
final repo = context.read <HtDataRepository <AppConfig >>();
267
261
paginatedResponse = await repo.readAllByQuery (
@@ -270,7 +264,6 @@ Future<Response> _handleGet(
270
264
startAfterId: startAfterId,
271
265
limit: limit,
272
266
);
273
- break ;
274
267
default :
275
268
throw OperationFailedException (
276
269
'Unsupported model type "$modelName " reached data retrieval switch.' ,
0 commit comments