Skip to content

Commit ba6185f

Browse files
committed
feat(country): extend country query to support name filter
- Add support for 'name' filter in country queries - Delegate queries with either 'usage' or 'name' filter to CountryService - Update documentation to reflect that sorting and pagination are handled by CountryService for these specialized queries
1 parent 3555cb4 commit ba6185f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/src/registry/data_operation_registry.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,11 @@ class DataOperationRegistry {
131131
),
132132
'country': (c, uid, f, s, p) async {
133133
final usage = f?['usage'] as String?;
134-
if (usage != null && usage.isNotEmpty) {
135-
// For 'country' model with 'usage' filter, delegate to CountryService.
136-
// Sorting and pagination are not supported for this specialized query.
134+
final name = f?['name'] as String?;
135+
136+
// If either 'usage' or 'name' filter is present, delegate to CountryService.
137+
// Sorting and pagination are handled by CountryService for these specialized queries.
138+
if ((usage != null && usage.isNotEmpty) || (name != null && name.isNotEmpty)) {
137139
final countryService = c.read<CountryService>();
138140
final countries = await countryService.getCountries(f);
139141
return PaginatedResponse<Country>(
@@ -142,7 +144,8 @@ class DataOperationRegistry {
142144
hasMore: false, // No more items as it's a complete filtered set
143145
);
144146
} else {
145-
// For standard requests, use the repository which supports pagination/sorting.
147+
// For standard requests without specialized filters, use the repository
148+
// which supports pagination/sorting.
146149
return c.read<DataRepository<Country>>().readAll(
147150
userId: uid,
148151
filter: f,

0 commit comments

Comments
 (0)