@@ -146,11 +146,13 @@ Future<Response> _handleGet(
146
146
startAfterId: startAfterId,
147
147
limit: limit,
148
148
);
149
- case 'user' : // Handle User model specifically if needed, or rely on generic
149
+ case 'user' :
150
150
final repo = context.read <HtDataRepository <User >>();
151
- // Note: readAll/readAllByQuery on User repo might need special handling
152
- // depending on whether non-admins can list *all* users or just their own.
153
- // Assuming for now readAll/readAllByQuery with userId scopes to owned.
151
+ // Note: While readAll/readAllByQuery is used here for consistency
152
+ // with the generic endpoint, fetching a specific user by ID via
153
+ // the /data/[id] route is the semantically preferred method.
154
+ // The userIdForRepoCall ensures scoping to the authenticated user
155
+ // if the repository supports it.
154
156
paginatedResponse = specificQuery.isNotEmpty
155
157
? await repo.readAllByQuery (
156
158
specificQuery,
@@ -163,8 +165,12 @@ Future<Response> _handleGet(
163
165
startAfterId: startAfterId,
164
166
limit: limit,
165
167
);
166
- case 'user_app_settings' : // New case for UserAppSettings
168
+ case 'user_app_settings' :
167
169
final repo = context.read <HtDataRepository <UserAppSettings >>();
170
+ // Note: While readAll/readAllByQuery is used here for consistency
171
+ // with the generic endpoint, fetching the user's settings by ID
172
+ // via the /data/[id] route is the semantically preferred method
173
+ // for this single-instance, user-owned model.
168
174
paginatedResponse = specificQuery.isNotEmpty
169
175
? await repo.readAllByQuery (
170
176
specificQuery,
@@ -177,8 +183,12 @@ Future<Response> _handleGet(
177
183
startAfterId: startAfterId,
178
184
limit: limit,
179
185
);
180
- case 'user_content_preferences' : // New case for UserContentPreferences
186
+ case 'user_content_preferences' :
181
187
final repo = context.read <HtDataRepository <UserContentPreferences >>();
188
+ // Note: While readAll/readAllByQuery is used here for consistency
189
+ // with the generic endpoint, fetching the user's preferences by ID
190
+ // via the /data/[id] route is the semantically preferred method
191
+ // for this single-instance, user-owned model.
182
192
paginatedResponse = specificQuery.isNotEmpty
183
193
? await repo.readAllByQuery (
184
194
specificQuery,
@@ -191,8 +201,12 @@ Future<Response> _handleGet(
191
201
startAfterId: startAfterId,
192
202
limit: limit,
193
203
);
194
- case 'app_config' : // New case for AppConfig (read by admin)
204
+ case 'app_config' :
195
205
final repo = context.read <HtDataRepository <AppConfig >>();
206
+ // Note: While readAll/readAllByQuery is used here for consistency
207
+ // with the generic endpoint, fetching the single AppConfig instance
208
+ // by its fixed ID ('app_config') via the /data/[id] route is the
209
+ // semantically preferred method for this global singleton model.
196
210
paginatedResponse = specificQuery.isNotEmpty
197
211
? await repo.readAllByQuery (
198
212
specificQuery,
0 commit comments