modifyPatients method
Future<List<IdWithRevDto> >
modifyPatients(
- UserDto user,
- List<
DecryptedPatientDto> patients, - CryptoConfig<
DecryptedPatientDto, PatientDto> config
Implementation
Future<List<IdWithRevDto>> modifyPatients(
UserDto user, List<DecryptedPatientDto> patients, CryptoConfig<DecryptedPatientDto, PatientDto> config) async {
final Set<String> delegations = <String>{...(user.autoDelegations["all"] ?? {}), ...(user.autoDelegations["medicalInformation"] ?? {})};
final List<PatientDto> encryptedPatients = await Future.wait(patients.map((patient) => config.encryptPatient(user.dataOwnerId()!, delegations, patient.initPatient())));
final List<IdWithRevDto>? modifiedIdsWithRevs = await this.rawModifyPatients(encryptedPatients);
return modifiedIdsWithRevs != null ? modifiedIdsWithRevs : List<IdWithRevDto>.empty();
}