Skip to content

Commit 92e75fe

Browse files
committed
fix(api): synchronize data route with RemoteConfig model rename
Replaces all occurrences of 'AppConfig' with 'RemoteConfig' and 'app_config' with 'remote_config' in the generic data collection route handler (/api/v1/data). This change aligns the route's logic with the recent model refactoring where the AppConfig model was renamed to RemoteConfig, resolving multiple type errors.
1 parent 8069022 commit 92e75fe

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

routes/api/v1/data/index.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Future<Response> onRequest(RequestContext context) async {
100100
/// Example: `/api/v1/data?model=country&q=US` (searches name and isoCode)
101101
/// - Other parameters for countries will result in a 400 Bad Request.
102102
///
103-
/// - **Other Models (User, UserAppSettings, UserContentPreferences, AppConfig):**
103+
/// - **Other Models (User, UserAppSettings, UserContentPreferences, RemoteConfig):**
104104
/// - Currently support exact match for top-level query parameters passed directly.
105105
/// - No specific complex filtering logic (like `_in` or `_contains`) is applied
106106
/// by this handler for these models yet. The `HtDataInMemoryClient` can
@@ -307,8 +307,8 @@ Future<Response> _handleGet(
307307
sortBy: sortBy,
308308
sortOrder: sortOrder,
309309
);
310-
case 'app_config':
311-
final repo = context.read<HtDataRepository<AppConfig>>();
310+
case 'remote_config':
311+
final repo = context.read<HtDataRepository<RemoteConfig>>();
312312
paginatedResponse = await repo.readAllByQuery(
313313
specificQueryForClient,
314314
userId: userIdForRepoCall,
@@ -440,10 +440,10 @@ Future<Response> _handlePost(
440440
throw const ForbiddenException(
441441
'UserContentPreferences creation is not allowed via the generic data endpoint.',
442442
);
443-
case 'app_config': // New case for AppConfig (create by admin)
444-
final repo = context.read<HtDataRepository<AppConfig>>();
443+
case 'remote_config': // New case for RemoteConfig (create by admin)
444+
final repo = context.read<HtDataRepository<RemoteConfig>>();
445445
createdItem = await repo.create(
446-
item: newItem as AppConfig,
446+
item: newItem as RemoteConfig,
447447
userId: userIdForRepoCall, // userId should be null for AppConfig
448448
);
449449
default:

0 commit comments

Comments
 (0)