filterPatientsBy method

Future<DecryptedPaginatedListPatientDto?> filterPatientsBy(
  1. UserDto user,
  2. FilterChain<PatientDto> filterChain,
  3. String? startKey,
  4. String? startDocumentId,
  5. int? limit,
  6. CryptoConfig<DecryptedPatientDto, PatientDto> config,
)

Implementation

Future<DecryptedPaginatedListPatientDto?> filterPatientsBy(UserDto user, FilterChain<PatientDto> filterChain, String? startKey, String? startDocumentId,
    int? limit, CryptoConfig<DecryptedPatientDto, PatientDto> config) async {

  return await (await this.rawFilterPatientsBy(filterChain, startKey: startKey, startDocumentId: startDocumentId, limit: limit))?.let((it) async =>
      DecryptedPaginatedListPatientDto(
          rows: await Future.wait(it.rows.map((it) => config.decryptPatient(user.dataOwnerId()!, it))),
          pageSize: it.pageSize,
          totalSize: it.totalSize,
          nextKeyPair: it.nextKeyPair)
  );
}