more refactors

This commit is contained in:
shenlong-tanwen
2024-10-19 14:34:42 +05:30
parent e8bb9a3934
commit 3b8951fde6
46 changed files with 598 additions and 435 deletions
@@ -12,7 +12,8 @@ class DeviceAssetToHashRepository
implements IDeviceAssetToHashRepository {
final DriftDatabaseRepository _db;
const DeviceAssetToHashRepository(this._db);
const DeviceAssetToHashRepository({required DriftDatabaseRepository db})
: _db = db;
@override
FutureOr<bool> upsertAll(Iterable<DeviceAssetToHash> assetHash) async {
@@ -31,10 +32,9 @@ class DeviceAssetToHashRepository
@override
Future<List<DeviceAssetToHash>> getForIds(Iterable<String> localIds) async {
return await _db.managers.deviceAssetToHash
.filter((f) => f.localId.isIn(localIds))
.map(_toModel)
.get();
final query = _db.deviceAssetToHash.select()
..where((f) => f.localId.isIn(localIds));
return await query.map(_toModel).get();
}
@override