client: Don't sync within database update methods

This commit is contained in:
Elias Projahn 2020-07-21 20:37:41 +02:00
parent 60989b2e18
commit 608726f555

View file

@ -119,12 +119,7 @@ class MusicusClientDatabase extends _$MusicusClientDatabase {
person, person,
mode: InsertMode.insertOrReplace, mode: InsertMode.insertOrReplace,
); );
if (person.sync && !person.synced) {
await client.putPerson(person);
await updatePerson(person.copyWith(synced: true));
} }
}
/// Delete the person by [id]. /// Delete the person by [id].
/// ///
@ -163,12 +158,7 @@ class MusicusClientDatabase extends _$MusicusClientDatabase {
instrument, instrument,
mode: InsertMode.insertOrReplace, mode: InsertMode.insertOrReplace,
); );
if (instrument.sync && !instrument.synced) {
await client.putInstrument(instrument);
await updateInstrument(instrument.copyWith(synced: true));
} }
}
/// Delete the instrument by [id]. /// Delete the instrument by [id].
/// ///
@ -299,13 +289,7 @@ class MusicusClientDatabase extends _$MusicusClientDatabase {
await into(workSections).insert(section); await into(workSections).insert(section);
} }
}); });
if (workInfo.work.sync && !workInfo.work.synced) {
await client.putWork(workInfo);
await into(works)
.insertOnConflictUpdate(workInfo.work.copyWith(synced: true));
} }
}
/// Delete the work by [id]. /// Delete the work by [id].
/// ///
@ -346,12 +330,7 @@ class MusicusClientDatabase extends _$MusicusClientDatabase {
ensemble, ensemble,
mode: InsertMode.insertOrReplace, mode: InsertMode.insertOrReplace,
); );
if (ensemble.sync && !ensemble.synced) {
await client.putEnsemble(ensemble);
await updateEnsemble(ensemble.copyWith(synced: true));
} }
}
/// Delete the ensemble by [id]. /// Delete the ensemble by [id].
/// ///
@ -400,12 +379,6 @@ class MusicusClientDatabase extends _$MusicusClientDatabase {
)); ));
} }
}); });
if (recordingInfo.recording.sync && !recordingInfo.recording.synced) {
await client.putRecording(recordingInfo);
await into(recordings).insertOnConflictUpdate(
recordingInfo.recording.copyWith(synced: true));
}
} }
/// Retreive more information on an already queried recording. /// Retreive more information on an already queried recording.