Skip to content

Commit e5d6849

Browse files
committed
feat(api): add language endpoints to data route
- Implement GET and POST endpoints for language data - Add readAll and create functionality for Language repository - Maintain consistent structure with existing endpoints
1 parent e6fb40d commit e5d6849

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

routes/api/v1/data/index.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ Future<Response> _handleGet(RequestContext context) async {
117117
sort: sort,
118118
pagination: pagination,
119119
);
120+
case 'language':
121+
final repo = context.read<DataRepository<Language>>();
122+
responseData = await repo.readAll(
123+
userId: userIdForRepoCall,
124+
filter: filter,
125+
sort: sort,
126+
pagination: pagination,
127+
);
120128
case 'user':
121129
final repo = context.read<DataRepository<User>>();
122130
responseData = await repo.readAll(
@@ -201,6 +209,12 @@ Future<Response> _handlePost(RequestContext context) async {
201209
item: itemToCreate as Country,
202210
userId: userIdForRepoCall,
203211
);
212+
case 'language':
213+
final repo = context.read<DataRepository<Language>>();
214+
createdItem = await repo.create(
215+
item: itemToCreate as Language,
216+
userId: userIdForRepoCall,
217+
);
204218
case 'remote_config':
205219
final repo = context.read<DataRepository<RemoteConfig>>();
206220
createdItem = await repo.create(

0 commit comments

Comments
 (0)