findByHCPartyPatient method

Future<List<DecryptedContactDto>> findByHCPartyPatient(
  1. UserDto user,
  2. String hcPartyId,
  3. PatientDto patient,
  4. String? planOfActionsIds,
  5. bool? skipClosedContacts,
  6. CryptoConfig<DecryptedContactDto, ContactDto> config,
)

Implementation

Future<List<DecryptedContactDto>> findByHCPartyPatient(UserDto user, String hcPartyId, PatientDto patient, String? planOfActionsIds,
    bool? skipClosedContacts, CryptoConfig<DecryptedContactDto, ContactDto> config) async {
  var keys = await config.crypto.decryptEncryptionKeys(user.dataOwnerId()!, patient.delegations);
  if (keys.isEmpty) {
    throw FormatException("No delegation for user");
  }
  return Future.wait((await this.rawListContactsByHCPartyAndPatientSecretFKeys(hcPartyId, keys.join(","),
          planOfActionsIds: planOfActionsIds, skipClosedContacts: skipClosedContacts))!
      .map((it) => config.decryptContact(user.dataOwnerId()!, it)));
}