diff --git a/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.dart b/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.dart index 9309603a2..1366f26bd 100644 --- a/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.dart +++ b/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.dart @@ -1,9 +1,5 @@ -import 'package:digit_dss/digit_dss.dart'; import 'package:isar/isar.dart'; -import '../../../../models/app_config/app_config_model.dart'; -import '../../../../models/privacy_notice/privacy_notice_model.dart'; - part 'app_configuration.g.dart'; @Collection() @@ -183,6 +179,13 @@ class SearchHouseHoldFilters { late bool active; } +@embedded +class SearchCLFFilters { + late String name; + late String code; + late bool active; +} + @embedded class HouseholdMemberDeletionReasonOptions { late String name; diff --git a/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.g.dart b/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.g.dart index d2e76c13c..a2688a4db 100644 --- a/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.g.dart +++ b/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.g.dart @@ -116,59 +116,65 @@ const AppConfigurationSchema = CollectionSchema( name: r'PROXIMITY_SEARCH_RANGE', type: IsarType.double, ), - r'SEARCH_HOUSEHOLD_FILTERS': PropertySchema( + r'SEARCH_CLF_FILTERS': PropertySchema( id: 17, + name: r'SEARCH_CLF_FILTERS', + type: IsarType.objectList, + target: r'SearchCLFFilters', + ), + r'SEARCH_HOUSEHOLD_FILTERS': PropertySchema( + id: 18, name: r'SEARCH_HOUSEHOLD_FILTERS', type: IsarType.objectList, target: r'SearchHouseHoldFilters', ), r'SYNC_METHOD': PropertySchema( - id: 18, + id: 19, name: r'SYNC_METHOD', type: IsarType.string, ), r'SYNC_TRIGGER': PropertySchema( - id: 19, + id: 20, name: r'SYNC_TRIGGER', type: IsarType.string, ), r'TENANT_ID': PropertySchema( - id: 20, + id: 21, name: r'TENANT_ID', type: IsarType.string, ), r'TRANSPORT_TYPES': PropertySchema( - id: 21, + id: 22, name: r'TRANSPORT_TYPES', type: IsarType.objectList, target: r'TransportTypes', ), r'houseStructureTypes': PropertySchema( - id: 22, + id: 23, name: r'houseStructureTypes', type: IsarType.objectList, target: r'HouseStructureTypes', ), r'privacyPolicyConfig': PropertySchema( - id: 23, + id: 24, name: r'privacyPolicyConfig', type: IsarType.object, target: r'PrivacyPolicy', ), r'referralReasons': PropertySchema( - id: 24, + id: 25, name: r'referralReasons', type: IsarType.objectList, target: r'ReferralReasons', ), r'refusalReasons': PropertySchema( - id: 25, + id: 26, name: r'refusalReasons', type: IsarType.objectList, target: r'RefusalReasons', ), r'symptomsTypes': PropertySchema( - id: 26, + id: 27, name: r'symptomsTypes', type: IsarType.objectList, target: r'SymptomsTypes', @@ -201,6 +207,7 @@ const AppConfigurationSchema = CollectionSchema( r'FirebaseConfig': FirebaseConfigSchema, r'SymptomsTypes': SymptomsTypesSchema, r'SearchHouseHoldFilters': SearchHouseHoldFiltersSchema, + r'SearchCLFFilters': SearchCLFFiltersSchema, r'ReferralReasons': ReferralReasonsSchema, r'HouseStructureTypes': HouseStructureTypesSchema, r'RefusalReasons': RefusalReasonsSchema, @@ -411,6 +418,20 @@ int _appConfigurationEstimateSize( bytesCount += 3 + value.length * 3; } } + { + final list = object.searchCLFFilters; + if (list != null) { + bytesCount += 3 + list.length * 3; + { + final offsets = allOffsets[SearchCLFFilters]!; + for (var i = 0; i < list.length; i++) { + final value = list[i]; + bytesCount += + SearchCLFFiltersSchema.estimateSize(value, offsets, allOffsets); + } + } + } + } { final list = object.searchHouseHoldFilters; if (list != null) { @@ -617,47 +638,53 @@ void _appConfigurationSerialize( writer.writeString(offsets[14], object.networkDetection); writer.writeString(offsets[15], object.persistenceMode); writer.writeDouble(offsets[16], object.maxRadius); - writer.writeObjectList( + writer.writeObjectList( offsets[17], allOffsets, + SearchCLFFiltersSchema.serialize, + object.searchCLFFilters, + ); + writer.writeObjectList( + offsets[18], + allOffsets, SearchHouseHoldFiltersSchema.serialize, object.searchHouseHoldFilters, ); - writer.writeString(offsets[18], object.syncMethod); - writer.writeString(offsets[19], object.syncTrigger); - writer.writeString(offsets[20], object.tenantId); + writer.writeString(offsets[19], object.syncMethod); + writer.writeString(offsets[20], object.syncTrigger); + writer.writeString(offsets[21], object.tenantId); writer.writeObjectList( - offsets[21], + offsets[22], allOffsets, TransportTypesSchema.serialize, object.transportTypes, ); writer.writeObjectList( - offsets[22], + offsets[23], allOffsets, HouseStructureTypesSchema.serialize, object.houseStructureTypes, ); writer.writeObject( - offsets[23], + offsets[24], allOffsets, PrivacyPolicySchema.serialize, object.privacyPolicyConfig, ); writer.writeObjectList( - offsets[24], + offsets[25], allOffsets, ReferralReasonsSchema.serialize, object.referralReasons, ); writer.writeObjectList( - offsets[25], + offsets[26], allOffsets, RefusalReasonsSchema.serialize, object.refusalReasons, ); writer.writeObjectList( - offsets[26], + offsets[27], allOffsets, SymptomsTypesSchema.serialize, object.symptomsTypes, @@ -758,47 +785,53 @@ AppConfiguration _appConfigurationDeserialize( object.networkDetection = reader.readStringOrNull(offsets[14]); object.persistenceMode = reader.readStringOrNull(offsets[15]); object.maxRadius = reader.readDoubleOrNull(offsets[16]); - object.searchHouseHoldFilters = reader.readObjectList( + object.searchCLFFilters = reader.readObjectList( offsets[17], + SearchCLFFiltersSchema.deserialize, + allOffsets, + SearchCLFFilters(), + ); + object.searchHouseHoldFilters = reader.readObjectList( + offsets[18], SearchHouseHoldFiltersSchema.deserialize, allOffsets, SearchHouseHoldFilters(), ); - object.syncMethod = reader.readStringOrNull(offsets[18]); - object.syncTrigger = reader.readStringOrNull(offsets[19]); - object.tenantId = reader.readStringOrNull(offsets[20]); + object.syncMethod = reader.readStringOrNull(offsets[19]); + object.syncTrigger = reader.readStringOrNull(offsets[20]); + object.tenantId = reader.readStringOrNull(offsets[21]); object.transportTypes = reader.readObjectList( - offsets[21], + offsets[22], TransportTypesSchema.deserialize, allOffsets, TransportTypes(), ); object.houseStructureTypes = reader.readObjectList( - offsets[22], + offsets[23], HouseStructureTypesSchema.deserialize, allOffsets, HouseStructureTypes(), ); object.id = id; object.privacyPolicyConfig = reader.readObjectOrNull( - offsets[23], + offsets[24], PrivacyPolicySchema.deserialize, allOffsets, ); object.referralReasons = reader.readObjectList( - offsets[24], + offsets[25], ReferralReasonsSchema.deserialize, allOffsets, ReferralReasons(), ); object.refusalReasons = reader.readObjectList( - offsets[25], + offsets[26], RefusalReasonsSchema.deserialize, allOffsets, RefusalReasons(), ); object.symptomsTypes = reader.readObjectList( - offsets[26], + offsets[27], SymptomsTypesSchema.deserialize, allOffsets, SymptomsTypes(), @@ -915,53 +948,60 @@ P _appConfigurationDeserializeProp

( case 16: return (reader.readDoubleOrNull(offset)) as P; case 17: + return (reader.readObjectList( + offset, + SearchCLFFiltersSchema.deserialize, + allOffsets, + SearchCLFFilters(), + )) as P; + case 18: return (reader.readObjectList( offset, SearchHouseHoldFiltersSchema.deserialize, allOffsets, SearchHouseHoldFilters(), )) as P; - case 18: - return (reader.readStringOrNull(offset)) as P; case 19: return (reader.readStringOrNull(offset)) as P; case 20: return (reader.readStringOrNull(offset)) as P; case 21: + return (reader.readStringOrNull(offset)) as P; + case 22: return (reader.readObjectList( offset, TransportTypesSchema.deserialize, allOffsets, TransportTypes(), )) as P; - case 22: + case 23: return (reader.readObjectList( offset, HouseStructureTypesSchema.deserialize, allOffsets, HouseStructureTypes(), )) as P; - case 23: + case 24: return (reader.readObjectOrNull( offset, PrivacyPolicySchema.deserialize, allOffsets, )) as P; - case 24: + case 25: return (reader.readObjectList( offset, ReferralReasonsSchema.deserialize, allOffsets, ReferralReasons(), )) as P; - case 25: + case 26: return (reader.readObjectList( offset, RefusalReasonsSchema.deserialize, allOffsets, RefusalReasons(), )) as P; - case 26: + case 27: return (reader.readObjectList( offset, SymptomsTypesSchema.deserialize, @@ -2690,6 +2730,113 @@ extension AppConfigurationQueryFilter }); } + QueryBuilder + searchCLFFiltersIsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'SEARCH_CLF_FILTERS', + )); + }); + } + + QueryBuilder + searchCLFFiltersIsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'SEARCH_CLF_FILTERS', + )); + }); + } + + QueryBuilder + searchCLFFiltersLengthEqualTo(int length) { + return QueryBuilder.apply(this, (query) { + return query.listLength( + r'SEARCH_CLF_FILTERS', + length, + true, + length, + true, + ); + }); + } + + QueryBuilder + searchCLFFiltersIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.listLength( + r'SEARCH_CLF_FILTERS', + 0, + true, + 0, + true, + ); + }); + } + + QueryBuilder + searchCLFFiltersIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.listLength( + r'SEARCH_CLF_FILTERS', + 0, + false, + 999999, + true, + ); + }); + } + + QueryBuilder + searchCLFFiltersLengthLessThan( + int length, { + bool include = false, + }) { + return QueryBuilder.apply(this, (query) { + return query.listLength( + r'SEARCH_CLF_FILTERS', + 0, + true, + length, + include, + ); + }); + } + + QueryBuilder + searchCLFFiltersLengthGreaterThan( + int length, { + bool include = false, + }) { + return QueryBuilder.apply(this, (query) { + return query.listLength( + r'SEARCH_CLF_FILTERS', + length, + include, + 999999, + true, + ); + }); + } + + QueryBuilder + searchCLFFiltersLengthBetween( + int lower, + int upper, { + bool includeLower = true, + bool includeUpper = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.listLength( + r'SEARCH_CLF_FILTERS', + lower, + includeLower, + upper, + includeUpper, + ); + }); + } + QueryBuilder searchHouseHoldFiltersIsNull() { return QueryBuilder.apply(this, (query) { @@ -3971,6 +4118,13 @@ extension AppConfigurationQueryObject }); } + QueryBuilder + searchCLFFiltersElement(FilterQuery q) { + return QueryBuilder.apply(this, (query) { + return query.object(q, r'SEARCH_CLF_FILTERS'); + }); + } + QueryBuilder searchHouseHoldFiltersElement(FilterQuery q) { return QueryBuilder.apply(this, (query) { @@ -4385,6 +4539,13 @@ extension AppConfigurationQueryProperty }); } + QueryBuilder?, QQueryOperations> + searchCLFFiltersProperty() { + return QueryBuilder.apply(this, (query) { + return query.addPropertyName(r'SEARCH_CLF_FILTERS'); + }); + } + QueryBuilder?, QQueryOperations> searchHouseHoldFiltersProperty() { return QueryBuilder.apply(this, (query) { @@ -8904,6 +9065,376 @@ extension SearchHouseHoldFiltersQueryObject on QueryBuilder< // coverage:ignore-file // ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types +const SearchCLFFiltersSchema = Schema( + name: r'SearchCLFFilters', + id: 6742638452277890113, + properties: { + r'active': PropertySchema( + id: 0, + name: r'active', + type: IsarType.bool, + ), + r'code': PropertySchema( + id: 1, + name: r'code', + type: IsarType.string, + ), + r'name': PropertySchema( + id: 2, + name: r'name', + type: IsarType.string, + ) + }, + estimateSize: _searchCLFFiltersEstimateSize, + serialize: _searchCLFFiltersSerialize, + deserialize: _searchCLFFiltersDeserialize, + deserializeProp: _searchCLFFiltersDeserializeProp, +); + +int _searchCLFFiltersEstimateSize( + SearchCLFFilters object, + List offsets, + Map> allOffsets, +) { + var bytesCount = offsets.last; + bytesCount += 3 + object.code.length * 3; + bytesCount += 3 + object.name.length * 3; + return bytesCount; +} + +void _searchCLFFiltersSerialize( + SearchCLFFilters object, + IsarWriter writer, + List offsets, + Map> allOffsets, +) { + writer.writeBool(offsets[0], object.active); + writer.writeString(offsets[1], object.code); + writer.writeString(offsets[2], object.name); +} + +SearchCLFFilters _searchCLFFiltersDeserialize( + Id id, + IsarReader reader, + List offsets, + Map> allOffsets, +) { + final object = SearchCLFFilters(); + object.active = reader.readBool(offsets[0]); + object.code = reader.readString(offsets[1]); + object.name = reader.readString(offsets[2]); + return object; +} + +P _searchCLFFiltersDeserializeProp

( + IsarReader reader, + int propertyId, + int offset, + Map> allOffsets, +) { + switch (propertyId) { + case 0: + return (reader.readBool(offset)) as P; + case 1: + return (reader.readString(offset)) as P; + case 2: + return (reader.readString(offset)) as P; + default: + throw IsarError('Unknown property with id $propertyId'); + } +} + +extension SearchCLFFiltersQueryFilter + on QueryBuilder { + QueryBuilder + activeEqualTo(bool value) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'active', + value: value, + )); + }); + } + + QueryBuilder + codeEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'code', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + codeGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'code', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + codeLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'code', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + codeBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'code', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + codeStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'code', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + codeEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'code', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + codeContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'code', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + codeMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'code', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + codeIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'code', + value: '', + )); + }); + } + + QueryBuilder + codeIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'code', + value: '', + )); + }); + } + + QueryBuilder + nameEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'name', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + nameGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'name', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + nameLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'name', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + nameBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'name', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + nameStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'name', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + nameEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'name', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + nameContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'name', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + nameMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'name', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + nameIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'name', + value: '', + )); + }); + } + + QueryBuilder + nameIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'name', + value: '', + )); + }); + } +} + +extension SearchCLFFiltersQueryObject + on QueryBuilder {} + +// coverage:ignore-file +// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types + const HouseholdMemberDeletionReasonOptionsSchema = Schema( name: r'HouseholdMemberDeletionReasonOptions', id: 752674668946516871, diff --git a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/mdms.dart b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/mdms.dart index 35136b342..d3df2bbee 100644 --- a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/mdms.dart +++ b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/mdms.dart @@ -8,7 +8,6 @@ import 'package:isar/isar.dart'; import '../../../models/app_config/app_config_model.dart' as app_configuration; import '../../../models/mdms/service_registry/pgr_service_defenitions.dart'; import '../../../models/mdms/service_registry/service_registry_model.dart'; -import '../../../models/privacy_notice/privacy_notice_model.dart'; import '../../../models/role_actions/role_actions_model.dart'; import '../../local_store/no_sql/schema/app_configuration.dart'; import '../../local_store/no_sql/schema/row_versions.dart'; @@ -244,8 +243,6 @@ class MdmsRepository { return content; }).toList(); - - final List? idTypeOptions = element?.idTypeOptions.map((element) { final idOption = IdTypeOptions() @@ -329,6 +326,14 @@ class MdmsRepository { ..active = e.active; return searchFilters; }).toList(); + appConfiguration.searchCLFFilters = + result.hcmWrapperModel?.searchCLFFilters?.map((e) { + final searchFilters = SearchCLFFilters() + ..name = e.name + ..code = e.code + ..active = e.active; + return searchFilters; + }).toList(); appConfiguration.symptomsTypes = result.hcmWrapperModel?.symptomsTypeList?.map((e) { diff --git a/packages/registration_delivery/lib/utils/utils.dart b/packages/registration_delivery/lib/utils/utils.dart index 07abc78d0..981f41077 100644 --- a/packages/registration_delivery/lib/utils/utils.dart +++ b/packages/registration_delivery/lib/utils/utils.dart @@ -361,7 +361,7 @@ class RegistrationDeliverySingleton { required List? deliveryCommentOptions, required List? symptomsTypes, required List? searchHouseHoldFilter, - searchCLFFilters, + required List? searchCLFFilters, required List? referralReasons, required List? houseStructureTypes, required List? refusalReasons,