mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
rework trashed assets handling
- add new table trashed_local_asset - mirror trashed assets data in trashed_local_asset. - compute checksums for assets trashed out-of-app. - restore assets present in trashed_local_asset and non-trashed in remote_asset. - simplify moving-to-trash logic based on remote_asset events.
This commit is contained in:
parent
3d56a5ca9c
commit
f7e5288173
29 changed files with 2085 additions and 876 deletions
76
mobile/lib/domain/models/asset/trashed_asset.model.dart
Normal file
76
mobile/lib/domain/models/asset/trashed_asset.model.dart
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
||||
|
||||
class TrashedAsset {
|
||||
final String id;
|
||||
final String name;
|
||||
final String albumId;
|
||||
final String? checksum;
|
||||
final AssetType type;
|
||||
final DateTime createdAt;
|
||||
final DateTime updatedAt;
|
||||
final int? size;
|
||||
|
||||
const TrashedAsset({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.checksum,
|
||||
required this.albumId,
|
||||
required this.type,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
this.size,
|
||||
});
|
||||
|
||||
TrashedAsset copyWith({
|
||||
String? id,
|
||||
String? name,
|
||||
String? albumId,
|
||||
String? checksum,
|
||||
AssetType? type,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
int? size,
|
||||
}) {
|
||||
return TrashedAsset(
|
||||
id: id ?? this.id,
|
||||
name: name ?? this.name,
|
||||
albumId: albumId ?? this.albumId,
|
||||
checksum: checksum ?? this.checksum,
|
||||
type: type ?? this.type,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
updatedAt: updatedAt ?? this.updatedAt,
|
||||
size: size ?? this.size,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'TrashedAsset('
|
||||
'id: $id, '
|
||||
'name: $name, '
|
||||
'albumId: $albumId, '
|
||||
'checksum: $checksum, '
|
||||
'type: $type, '
|
||||
'createdAt: $createdAt, '
|
||||
'updatedAt: $updatedAt, '
|
||||
'size: ${size ?? "<NA>"}'
|
||||
')';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is TrashedAsset &&
|
||||
runtimeType == other.runtimeType &&
|
||||
id == other.id &&
|
||||
name == other.name &&
|
||||
albumId == other.albumId &&
|
||||
checksum == other.checksum &&
|
||||
type == other.type &&
|
||||
createdAt == other.createdAt &&
|
||||
updatedAt == other.updatedAt &&
|
||||
size == other.size;
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(id, name, albumId, checksum, type, createdAt, updatedAt, size);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue