2024-09-16 22:26:14 +02:00
|
|
|
import 'package:immich_mobile/entities/album.entity.dart';
|
|
|
|
import 'package:immich_mobile/entities/asset.entity.dart';
|
2024-09-24 14:50:21 +02:00
|
|
|
import 'package:immich_mobile/entities/device_asset.entity.dart';
|
2024-09-30 16:37:30 +02:00
|
|
|
import 'package:immich_mobile/interfaces/database.interface.dart';
|
2024-09-16 22:26:14 +02:00
|
|
|
|
2024-09-30 16:37:30 +02:00
|
|
|
abstract interface class IAssetRepository implements IDatabaseRepository {
|
2024-09-20 15:32:37 +02:00
|
|
|
Future<Asset?> getByRemoteId(String id);
|
2024-09-30 16:37:30 +02:00
|
|
|
|
|
|
|
Future<Asset?> getByOwnerIdChecksum(int ownerId, String checksum);
|
|
|
|
|
|
|
|
Future<List<Asset>> getAllByRemoteId(
|
|
|
|
Iterable<String> ids, {
|
|
|
|
AssetState? state,
|
|
|
|
});
|
|
|
|
|
|
|
|
Future<List<Asset?>> getAllByOwnerIdChecksum(
|
|
|
|
List<int> ids,
|
|
|
|
List<String> checksums,
|
|
|
|
);
|
|
|
|
|
2024-09-24 08:24:48 +02:00
|
|
|
Future<List<Asset>> getAll({
|
|
|
|
required int ownerId,
|
2024-09-30 16:37:30 +02:00
|
|
|
AssetState? state,
|
|
|
|
AssetSort? sortBy,
|
|
|
|
int? limit,
|
|
|
|
});
|
|
|
|
|
|
|
|
Future<List<Asset>> getAllLocal();
|
|
|
|
|
|
|
|
Future<List<Asset>> getByAlbum(
|
|
|
|
Album album, {
|
|
|
|
Iterable<int> notOwnedBy = const [],
|
|
|
|
int? ownerId,
|
|
|
|
AssetState? state,
|
|
|
|
AssetSort? sortBy,
|
2024-09-24 08:24:48 +02:00
|
|
|
});
|
2024-09-30 16:37:30 +02:00
|
|
|
|
|
|
|
Future<Asset> update(Asset asset);
|
|
|
|
|
2024-09-24 14:50:21 +02:00
|
|
|
Future<List<Asset>> updateAll(List<Asset> assets);
|
2024-09-24 08:24:48 +02:00
|
|
|
|
2024-09-30 16:37:30 +02:00
|
|
|
Future<void> deleteAllByRemoteId(List<String> ids, {AssetState? state});
|
|
|
|
|
|
|
|
Future<void> deleteById(List<int> ids);
|
|
|
|
|
2024-09-24 08:24:48 +02:00
|
|
|
Future<List<Asset>> getMatches({
|
|
|
|
required List<Asset> assets,
|
|
|
|
required int ownerId,
|
2024-09-30 16:37:30 +02:00
|
|
|
AssetState? state,
|
2024-09-24 08:24:48 +02:00
|
|
|
int limit = 100,
|
|
|
|
});
|
2024-09-24 14:50:21 +02:00
|
|
|
|
|
|
|
Future<List<DeviceAsset?>> getDeviceAssetsById(List<Object> ids);
|
2024-09-30 16:37:30 +02:00
|
|
|
|
2024-09-24 14:50:21 +02:00
|
|
|
Future<void> upsertDeviceAssets(List<DeviceAsset> deviceAssets);
|
2024-09-30 16:37:30 +02:00
|
|
|
|
|
|
|
Future<void> upsertDuplicatedAssets(Iterable<String> duplicatedAssets);
|
|
|
|
|
|
|
|
Future<List<String>> getAllDuplicatedAssetIds();
|
2024-09-16 22:26:14 +02:00
|
|
|
}
|
2024-09-30 16:37:30 +02:00
|
|
|
|
|
|
|
enum AssetSort { checksum, ownerIdChecksum }
|