Skip to content

Commit e2d5b91

Browse files
refactor: rename to getByIds
1 parent f64adb1 commit e2d5b91

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

mobile/lib/domain/interfaces/device_asset.interface.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import 'package:immich_mobile/domain/models/device_asset.model.dart';
66
abstract interface class IDeviceAssetRepository implements IDatabaseRepository {
77
Future<bool> updateAll(List<DeviceAsset> assetHash);
88

9-
Future<List<DeviceAsset>> getForIds(List<String> localIds);
9+
Future<List<DeviceAsset>> getByIds(List<String> localIds);
1010

1111
Future<void> deleteIds(List<String> ids);
1212
}

mobile/lib/infrastructure/repositories/device_asset.repository.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class IsarDeviceAssetRepository extends IsarDatabaseRepository
1818
}
1919

2020
@override
21-
Future<List<DeviceAsset>> getForIds(List<String> localIds) {
21+
Future<List<DeviceAsset>> getByIds(List<String> localIds) {
2222
return _db.deviceAssetEntitys
2323
.where()
2424
.anyOf(localIds, (query, id) => query.assetIdEqualTo(id))

mobile/lib/services/hash.service.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class HashService {
3535
assets.sort(Asset.compareByLocalId);
3636

3737
// Get and sort DB entries - guaranteed to be a subset of assets
38-
final hashesInDB = await _deviceAssetRepository.getForIds(
38+
final hashesInDB = await _deviceAssetRepository.getByIds(
3939
assets.map((a) => a.localId!).toList(),
4040
);
4141
hashesInDB.sort((a, b) => a.assetId.compareTo(b.assetId));

mobile/test/domain/services/hash_service_test.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void main() {
5959
.thenAnswer((_) async => [hash]);
6060
// No DB entries for this asset
6161
when(
62-
() => mockDeviceAssetRepository.getForIds([AssetStub.image1.localId!]),
62+
() => mockDeviceAssetRepository.getByIds([AssetStub.image1.localId!]),
6363
).thenAnswer((_) async => []);
6464

6565
final result = await sut.hashAssets([mockAsset]);
@@ -92,7 +92,7 @@ void main() {
9292
final hash = utf8.encode("image1-hash");
9393

9494
when(
95-
() => mockDeviceAssetRepository.getForIds([AssetStub.image1.localId!]),
95+
() => mockDeviceAssetRepository.getByIds([AssetStub.image1.localId!]),
9696
).thenAnswer(
9797
(_) async => [
9898
DeviceAsset(
@@ -121,7 +121,7 @@ void main() {
121121
when(() => mockBackgroundService.digestFiles([file.path]))
122122
.thenAnswer((_) async => [hash]);
123123
when(
124-
() => mockDeviceAssetRepository.getForIds([AssetStub.image1.localId!]),
124+
() => mockDeviceAssetRepository.getByIds([AssetStub.image1.localId!]),
125125
).thenAnswer((_) async => [deviceAsset]);
126126

127127
final result = await sut.hashAssets([mockAsset]);
@@ -163,7 +163,7 @@ void main() {
163163
when(() => mockBackgroundService.digestFiles([file.path]))
164164
.thenAnswer((_) async => [hash]);
165165
when(
166-
() => mockDeviceAssetRepository.getForIds([AssetStub.image1.localId!]),
166+
() => mockDeviceAssetRepository.getByIds([AssetStub.image1.localId!]),
167167
).thenAnswer((_) async => [deviceAsset]);
168168
});
169169

@@ -240,7 +240,7 @@ void main() {
240240
final (asset2, file2, deviceAsset2, hash2) = mock2;
241241
final (asset3, file3, deviceAsset3, hash3) = mock3;
242242

243-
when(() => mockDeviceAssetRepository.getForIds(any()))
243+
when(() => mockDeviceAssetRepository.getByIds(any()))
244244
.thenAnswer((_) async => []);
245245

246246
// Setup for multiple batch processing calls
@@ -285,7 +285,7 @@ void main() {
285285
final (asset2, file2, deviceAsset2, hash2) = mock2;
286286
final (asset3, file3, deviceAsset3, hash3) = mock3;
287287

288-
when(() => mockDeviceAssetRepository.getForIds(any()))
288+
when(() => mockDeviceAssetRepository.getByIds(any()))
289289
.thenAnswer((_) async => []);
290290

291291
when(() => mockBackgroundService.digestFiles([file1.path]))
@@ -331,7 +331,7 @@ void main() {
331331
.thenAnswer((_) async => [hash1, hash3]);
332332
// DB entries are not sorted and a dummy entry added
333333
when(
334-
() => mockDeviceAssetRepository.getForIds([
334+
() => mockDeviceAssetRepository.getByIds([
335335
AssetStub.image1.localId!,
336336
AssetStub.image2.localId!,
337337
AssetStub.image3.localId!,
@@ -361,7 +361,7 @@ void main() {
361361

362362
group("HashService: Edge cases", () {
363363
test("handles empty list of assets", () async {
364-
when(() => mockDeviceAssetRepository.getForIds(any()))
364+
when(() => mockDeviceAssetRepository.getByIds(any()))
365365
.thenAnswer((_) async => []);
366366

367367
final result = await sut.hashAssets([]);
@@ -376,7 +376,7 @@ void main() {
376376
test("handles all file access failures", () async {
377377
// No DB entries
378378
when(
379-
() => mockDeviceAssetRepository.getForIds(
379+
() => mockDeviceAssetRepository.getByIds(
380380
[AssetStub.image1.localId!, AssetStub.image2.localId!],
381381
),
382382
).thenAnswer((_) async => []);

0 commit comments

Comments
 (0)