Add error handling for geo assets

This commit is contained in:
problematicconsumer
2023-11-17 23:22:12 +03:30
parent 4a6b112087
commit 436fc8133c
13 changed files with 113 additions and 43 deletions

View File

@@ -28,6 +28,12 @@ class GeoAssetsDao extends DatabaseAccessor<AppDatabase>
Future<void> edit(GeoAsset patch) async {
await transaction(
() async {
if (patch.active) {
await (update(geoAssetEntries)
..where((tbl) => tbl.active.equals(true))
..where((tbl) => tbl.type.equalsValue(patch.type)))
.write(const GeoAssetEntriesCompanion(active: Value(false)));
}
await (update(geoAssetEntries)..where((tbl) => tbl.id.equals(patch.id)))
.write(patch.toCompanion());
},