mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-26 18:57:25 +01:00
client: Set sync status for works and recordings
This commit is contained in:
parent
d566e6c473
commit
6c7891de14
3 changed files with 67 additions and 22 deletions
|
|
@ -120,7 +120,7 @@ class MusicusClientDatabase extends _$MusicusClientDatabase {
|
|||
mode: InsertMode.insertOrReplace,
|
||||
);
|
||||
|
||||
if (person.sync) {
|
||||
if (person.sync && !person.synced) {
|
||||
await client.putPerson(person);
|
||||
await updatePerson(person.copyWith(synced: true));
|
||||
}
|
||||
|
|
@ -164,7 +164,7 @@ class MusicusClientDatabase extends _$MusicusClientDatabase {
|
|||
mode: InsertMode.insertOrReplace,
|
||||
);
|
||||
|
||||
if (instrument.sync) {
|
||||
if (instrument.sync && !instrument.synced) {
|
||||
await client.putInstrument(instrument);
|
||||
await updateInstrument(instrument.copyWith(synced: true));
|
||||
}
|
||||
|
|
@ -296,7 +296,7 @@ class MusicusClientDatabase extends _$MusicusClientDatabase {
|
|||
}
|
||||
});
|
||||
|
||||
if (workInfo.work.sync) {
|
||||
if (workInfo.work.sync && !workInfo.work.synced) {
|
||||
await client.putWork(workInfo);
|
||||
await into(works)
|
||||
.insertOnConflictUpdate(workInfo.work.copyWith(synced: true));
|
||||
|
|
@ -343,7 +343,7 @@ class MusicusClientDatabase extends _$MusicusClientDatabase {
|
|||
mode: InsertMode.insertOrReplace,
|
||||
);
|
||||
|
||||
if (ensemble.sync) {
|
||||
if (ensemble.sync && !ensemble.synced) {
|
||||
await client.putEnsemble(ensemble);
|
||||
await updateEnsemble(ensemble.copyWith(synced: true));
|
||||
}
|
||||
|
|
@ -397,7 +397,7 @@ class MusicusClientDatabase extends _$MusicusClientDatabase {
|
|||
}
|
||||
});
|
||||
|
||||
if (recordingInfo.recording.sync) {
|
||||
if (recordingInfo.recording.sync && !recordingInfo.recording.synced) {
|
||||
await client.putRecording(recordingInfo);
|
||||
await into(recordings).insertOnConflictUpdate(
|
||||
recordingInfo.recording.copyWith(synced: true));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue