1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-16 07:24:40 +02:00

chore(mobile): remove exclude album mechanism for backup (#10552)

* chore(mobile): remove exclude album selection mechanism

* code generator

* code generator
This commit is contained in:
Alex
2024-06-22 15:31:27 -07:00
committed by GitHub
parent 8e2f6f1f41
commit 5f47cf604a
12 changed files with 32 additions and 309 deletions

View File

@ -65,14 +65,10 @@ class BackupService {
QueryBuilder<BackupAlbum, BackupAlbum, QAfterFilterCondition>
selectedAlbumsQuery() =>
_db.backupAlbums.filter().selectionEqualTo(BackupSelection.select);
QueryBuilder<BackupAlbum, BackupAlbum, QAfterFilterCondition>
excludedAlbumsQuery() =>
_db.backupAlbums.filter().selectionEqualTo(BackupSelection.exclude);
/// Returns all assets newer than the last successful backup per album
Future<List<AssetEntity>> buildUploadCandidates(
List<BackupAlbum> selectedBackupAlbums,
List<BackupAlbum> excludedBackupAlbums,
) async {
final filter = FilterOptionGroup(
containsPathModified: true,
@ -89,19 +85,13 @@ class BackupService {
}
final int allIdx = selectedAlbums.indexWhere((e) => e != null && e.isAll);
if (allIdx != -1) {
final List<AssetPathEntity?> excludedAlbums =
await _loadAlbumsWithTimeFilter(excludedBackupAlbums, filter, now);
final List<AssetEntity> toAdd = await _fetchAssetsAndUpdateLastBackup(
selectedAlbums.slice(allIdx, allIdx + 1),
selectedBackupAlbums.slice(allIdx, allIdx + 1),
now,
);
final List<AssetEntity> toRemove = await _fetchAssetsAndUpdateLastBackup(
excludedAlbums,
excludedBackupAlbums,
now,
);
return toAdd.toSet().difference(toRemove.toSet()).toList();
return toAdd.toSet().toList();
} else {
return await _fetchAssetsAndUpdateLastBackup(
selectedAlbums,