createOrModifyHealthcareProfessional method

  1. @override
Future<HealthcareProfessional?> createOrModifyHealthcareProfessional(
  1. HealthcareProfessional healthcareProfessional
)
override

Creates a new healthcare professional or modify an existing one.

Parameters:

  • HealthcareProfessional healthcareProfessional (required): The healthcare professional that must be created in the database.

Implementation

@override
Future<HealthcareProfessional?> createOrModifyHealthcareProfessional(HealthcareProfessional healthcareProfessional) async =>
    (await (healthcareProfessional.rev?.let((it) => api.baseHealthcarePartyApi.modifyHealthcareParty(healthcareProfessional.toHealthcarePartyDto())) ??
            api.baseHealthcarePartyApi.createHealthcareParty(healthcareProfessional.toHealthcarePartyDto())))
        ?.toHealthcareProfessional()
        ?? (throw StateError("Could not create or modify healthcare professional ${healthcareProfessional.id}"));