findByHCPartyAndPatient method

Future<List<DecryptedDocumentDto>> findByHCPartyAndPatient(
  1. UserDto user,
  2. String hcpId,
  3. DecryptedPatientDto patient,
  4. CryptoConfig<DecryptedDocumentDto, DocumentDto> config,
)

Implementation

Future<List<DecryptedDocumentDto>> findByHCPartyAndPatient(UserDto user, String hcpId, DecryptedPatientDto patient, CryptoConfig<DecryptedDocumentDto, DocumentDto> config) async {
  var keys = await config.crypto.decryptEncryptionKeys(user.dataOwnerId()!, patient.delegations);
  if (keys.isEmpty) {
    throw FormatException("No delegations for user");
  }

  return this.findByHCPartyAndPatientForeignKeys(user, hcpId, keys.join(","), config);
}