listHealthElementsByHCPartyAndPatientForeignKeys method

Future<List<DecryptedHealthElementDto>> listHealthElementsByHCPartyAndPatientForeignKeys(
  1. UserDto user,
  2. String hcPartyId,
  3. String secretFKeys,
  4. CryptoConfig<DecryptedHealthElementDto, HealthElementDto> config,
)

Implementation

Future<List<DecryptedHealthElementDto>> listHealthElementsByHCPartyAndPatientForeignKeys(UserDto user, String hcPartyId, String secretFKeys,
    CryptoConfig<DecryptedHealthElementDto, HealthElementDto> config) async {
  final List<HealthElementDto>? healthElements = await this.rawListHealthElementsByHCPartyAndPatientForeignKeys(hcPartyId, secretFKeys);
  if (healthElements == null || healthElements.isEmpty) {
    throw Exception("No delegation for this user");
  }
  return await Future.wait(healthElements.map((healthElement) => config.decryptHealthElement(user.dataOwnerId()!, healthElement)));
}