You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-08-10 23:22:22 +02:00
chore: Revert "feat(mobile): remote album sync" (#19159)
Revert "feat(mobile): remote album sync (#18876)"
This reverts commit 242817c49a
.
This commit is contained in:
@@ -3,19 +3,12 @@ import 'package:immich_mobile/domain/interfaces/sync_stream.interface.dart';
|
||||
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/exif.entity.drift.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/partner.entity.drift.dart';
|
||||
import 'package:immich_mobile/domain/models/album/album.model.dart';
|
||||
import 'package:immich_mobile/domain/models/album_user.model.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/album_user.entity.drift.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/remote_album.entity.drift.dart';
|
||||
// import 'package:immich_mobile/infrastructure/entities/remote_album_asset.entity.drift.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.drift.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/user.entity.drift.dart';
|
||||
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:openapi/api.dart' as api
|
||||
show AssetVisibility, AssetOrder, AlbumUserRole;
|
||||
import 'package:openapi/api.dart'
|
||||
hide AssetVisibility, AssetOrder, AlbumUserRole;
|
||||
import 'package:openapi/api.dart' as api show AssetVisibility;
|
||||
import 'package:openapi/api.dart' hide AssetVisibility;
|
||||
|
||||
class DriftSyncStreamRepository extends DriftDatabaseRepository
|
||||
implements ISyncStreamRepository {
|
||||
@@ -168,135 +161,6 @@ class DriftSyncStreamRepository extends DriftDatabaseRepository
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> updateAlbumsV1(Iterable<SyncAlbumV1> data) async {
|
||||
try {
|
||||
await _db.batch((batch) {
|
||||
for (final album in data) {
|
||||
final companion = RemoteAlbumEntityCompanion(
|
||||
name: Value(album.name),
|
||||
description: Value(album.description),
|
||||
ownerId: Value(album.ownerId),
|
||||
thumbnailAssetId: Value(album.thumbnailAssetId),
|
||||
createdAt: Value(album.createdAt),
|
||||
updatedAt: Value(album.updatedAt),
|
||||
isActivityEnabled: Value(album.isActivityEnabled),
|
||||
order: Value(album.order.toAssetOrder()),
|
||||
);
|
||||
|
||||
batch.insert(
|
||||
_db.remoteAlbumEntity,
|
||||
companion.copyWith(id: Value(album.id)),
|
||||
onConflict: DoUpdate((_) => companion),
|
||||
);
|
||||
}
|
||||
});
|
||||
} catch (e, s) {
|
||||
_logger.severe('Error while processing updateAlbumsV1', e, s);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> deleteAlbumsV1(Iterable<SyncAlbumDeleteV1> data) async {
|
||||
try {
|
||||
_db.batch((batch) {
|
||||
for (final album in data) {
|
||||
batch.delete(
|
||||
_db.remoteAlbumEntity,
|
||||
RemoteAlbumEntityCompanion(id: Value(album.albumId)),
|
||||
);
|
||||
}
|
||||
});
|
||||
} catch (e, s) {
|
||||
_logger.severe('Error while processing deleteAlbumsV1', e, s);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
// @override
|
||||
// Future<void> updateAlbumAssetsV1(Iterable<SyncAlbumAssetV1> data) async {
|
||||
// try {
|
||||
// await _db.remoteAlbumAssetEntity.insertAll(
|
||||
// data.map(
|
||||
// (albumAsset) => RemoteAlbumAssetEntityCompanion.insert(
|
||||
// albumId: albumAsset.albumId,
|
||||
// assetId: albumAsset.assetId,
|
||||
// ),
|
||||
// ),
|
||||
// mode: InsertMode.insertOrIgnore,
|
||||
// );
|
||||
// } catch (e, s) {
|
||||
// _logger.severe('Error while processing updateAlbumAssetsV1', e, s);
|
||||
// rethrow;
|
||||
// }
|
||||
// }
|
||||
|
||||
// @override
|
||||
// Future<void> deleteAlbumAssetsV1(Iterable<SyncAlbumAssetDeleteV1> data) async {
|
||||
// try {
|
||||
// await _db.batch((batch) {
|
||||
// for (final albumAsset in data) {
|
||||
// batch.delete(
|
||||
// _db.remoteAlbumAssetEntity,
|
||||
// RemoteAlbumAssetEntityCompanion(
|
||||
// albumId: Value(albumAsset.albumId),
|
||||
// assetId: Value(albumAsset.assetId),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
// } catch (e, s) {
|
||||
// _logger.severe('Error while processing deleteAlbumAssetsV1', e, s);
|
||||
// rethrow;
|
||||
// }
|
||||
// }
|
||||
|
||||
@override
|
||||
Future<void> updateAlbumUsersV1(Iterable<SyncAlbumUserV1> data) async {
|
||||
try {
|
||||
await _db.batch((batch) {
|
||||
for (final albumUser in data) {
|
||||
final companion = AlbumUserEntityCompanion(
|
||||
role: Value(albumUser.role.toAlbumUserRole()),
|
||||
);
|
||||
|
||||
batch.insert(
|
||||
_db.albumUserEntity,
|
||||
companion.copyWith(
|
||||
albumId: Value(albumUser.albumId),
|
||||
userId: Value(albumUser.userId),
|
||||
),
|
||||
onConflict: DoUpdate((_) => companion),
|
||||
);
|
||||
}
|
||||
});
|
||||
} catch (e, s) {
|
||||
_logger.severe('Error while processing updateAlbumUsersV1', e, s);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> deleteAlbumUsersV1(Iterable<SyncAlbumUserDeleteV1> data) async {
|
||||
try {
|
||||
await _db.batch((batch) {
|
||||
for (final albumUser in data) {
|
||||
batch.delete(
|
||||
_db.albumUserEntity,
|
||||
AlbumUserEntityCompanion(
|
||||
albumId: Value(albumUser.albumId),
|
||||
userId: Value(albumUser.userId),
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
} catch (e, s) {
|
||||
_logger.severe('Error while processing deleteAlbumUsersV1', e, s);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _updateAssetsV1(Iterable<SyncAssetV1> data) =>
|
||||
_db.batch((batch) {
|
||||
for (final asset in data) {
|
||||
@@ -387,19 +251,3 @@ extension on api.AssetVisibility {
|
||||
_ => throw Exception('Unknown AssetVisibility value: $this'),
|
||||
};
|
||||
}
|
||||
|
||||
extension on api.AssetOrder {
|
||||
AssetOrder toAssetOrder() => switch (this) {
|
||||
api.AssetOrder.asc => AssetOrder.asc,
|
||||
api.AssetOrder.desc => AssetOrder.desc,
|
||||
_ => throw Exception('Unknown AssetOrder value: $this'),
|
||||
};
|
||||
}
|
||||
|
||||
extension on api.AlbumUserRole {
|
||||
AlbumUserRole toAlbumUserRole() => switch (this) {
|
||||
api.AlbumUserRole.editor => AlbumUserRole.editor,
|
||||
api.AlbumUserRole.viewer => AlbumUserRole.viewer,
|
||||
_ => throw Exception('Unknown AlbumUserRole value: $this'),
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user