update method
The update
method updates an existing entity.
Implementation
@override
FutureOr<void> update(
HFReferralModel entity, {
bool createOpLog = true,
}) async {
return retryLocalCallOperation(() async {
final referralCompanion = entity.companion.copyWith(
name: Value(entity.additionalFields?.fields
.where(
(h) =>
h.key ==
ReferralReconAdditionalFields.nameOfReferral.toValue(),
)
.first
.value),
);
await sql.batch((batch) {
batch.update(
sql.hFReferral,
referralCompanion,
where: (table) => table.clientReferenceId.equals(
entity.clientReferenceId,
),
);
});
await super.update(entity, createOpLog: createOpLog);
});
}