deleteServicesWithPatientInfo method

Future<DecryptedContactDto?> deleteServicesWithPatientInfo(
  1. UserDto user,
  2. String patientId,
  3. Map<String, Set<DelegationDto>> patientDelegations,
  4. List<DecryptedServiceDto> services,
  5. CryptoConfig<DecryptedContactDto, ContactDto> config,
)

Implementation

Future<DecryptedContactDto?> deleteServicesWithPatientInfo(
    UserDto user,
    String patientId,
    Map<String, Set<DelegationDto>> patientDelegations,
    List<DecryptedServiceDto> services,
    CryptoConfig<DecryptedContactDto, ContactDto> config
    ) {
  final Uuid uuid = Uuid();
  final currentTime = DateTime
      .now()
      .millisecondsSinceEpoch;
  return this.createContactWithPatientInfo(
      user,
      patientId,
      patientDelegations,
      DecryptedContactDto(
          id: uuid.v4(options: {'rng': UuidUtil.cryptoRNG}),
          services:
          services.map((it) => DecryptedServiceDto(id: it.id, created: it.created, modified: currentTime, endOfLife: currentTime)).toSet()),
      config);
}