filterHealthElements method

Future<DecryptedPaginatedListHealthElementDto> filterHealthElements(
  1. UserDto user,
  2. FilterChain<HealthElementDto> filterChainHealthElement,
  3. CryptoConfig<DecryptedHealthElementDto, HealthElementDto> config,
  4. String? startDocumentId,
  5. int? limit,
)

Implementation

Future<DecryptedPaginatedListHealthElementDto> filterHealthElements(UserDto user, FilterChain<HealthElementDto> filterChainHealthElement,
    CryptoConfig<DecryptedHealthElementDto, HealthElementDto> config, String? startDocumentId, int? limit) async {
  final PaginatedListHealthElementDto? paginatedListHealthElement =
  await this.rawFilterHealthElementsBy(filterChainHealthElement, startDocumentId: startDocumentId, limit: limit);
  if (paginatedListHealthElement == null) {
    throw Exception("Couldn't get the paginatedList");
  }
  final List<DecryptedHealthElementDto> rows =
  await Future.wait(paginatedListHealthElement.rows.map((e) => config.decryptHealthElement(user.dataOwnerId()!, e)));
  return DecryptedPaginatedListHealthElementDto(
      pageSize: paginatedListHealthElement.pageSize,
      totalSize: paginatedListHealthElement.totalSize,
      rows: rows,
      nextKeyPair: paginatedListHealthElement.nextKeyPair);
}