1
0
mirror of https://github.com/immich-app/immich.git synced 2025-08-08 23:07:06 +02:00

feat: add album asset sync (#19503)

wip: fix album asset exif and some other refactorings

feat: add album assets sync

feat: album to assets relation sync

Co-authored-by: Zack Pollard <zackpollard@ymail.com>
This commit is contained in:
Jason Rasmussen
2025-06-25 12:10:31 -04:00
committed by GitHub
parent b001ba44f5
commit 881a96cdf9
25 changed files with 1706 additions and 90 deletions

View File

@ -249,6 +249,7 @@ part 'model/sync_ack_delete_dto.dart';
part 'model/sync_ack_dto.dart';
part 'model/sync_ack_set_dto.dart';
part 'model/sync_album_delete_v1.dart';
part 'model/sync_album_to_asset_v1.dart';
part 'model/sync_album_user_delete_v1.dart';
part 'model/sync_album_user_v1.dart';
part 'model/sync_album_v1.dart';

View File

@ -554,6 +554,8 @@ class ApiClient {
return SyncAckSetDto.fromJson(value);
case 'SyncAlbumDeleteV1':
return SyncAlbumDeleteV1.fromJson(value);
case 'SyncAlbumToAssetV1':
return SyncAlbumToAssetV1.fromJson(value);
case 'SyncAlbumUserDeleteV1':
return SyncAlbumUserDeleteV1.fromJson(value);
case 'SyncAlbumUserV1':

View File

@ -0,0 +1,107 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.18
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class SyncAlbumToAssetV1 {
/// Returns a new [SyncAlbumToAssetV1] instance.
SyncAlbumToAssetV1({
required this.albumId,
required this.assetId,
});
String albumId;
String assetId;
@override
bool operator ==(Object other) => identical(this, other) || other is SyncAlbumToAssetV1 &&
other.albumId == albumId &&
other.assetId == assetId;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(albumId.hashCode) +
(assetId.hashCode);
@override
String toString() => 'SyncAlbumToAssetV1[albumId=$albumId, assetId=$assetId]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'albumId'] = this.albumId;
json[r'assetId'] = this.assetId;
return json;
}
/// Returns a new [SyncAlbumToAssetV1] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static SyncAlbumToAssetV1? fromJson(dynamic value) {
upgradeDto(value, "SyncAlbumToAssetV1");
if (value is Map) {
final json = value.cast<String, dynamic>();
return SyncAlbumToAssetV1(
albumId: mapValueOfType<String>(json, r'albumId')!,
assetId: mapValueOfType<String>(json, r'assetId')!,
);
}
return null;
}
static List<SyncAlbumToAssetV1> listFromJson(dynamic json, {bool growable = false,}) {
final result = <SyncAlbumToAssetV1>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = SyncAlbumToAssetV1.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, SyncAlbumToAssetV1> mapFromJson(dynamic json) {
final map = <String, SyncAlbumToAssetV1>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = SyncAlbumToAssetV1.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of SyncAlbumToAssetV1-objects as value to a dart map
static Map<String, List<SyncAlbumToAssetV1>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<SyncAlbumToAssetV1>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = SyncAlbumToAssetV1.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'albumId',
'assetId',
};
}

View File

@ -40,6 +40,13 @@ class SyncEntityType {
static const albumUserV1 = SyncEntityType._(r'AlbumUserV1');
static const albumUserBackfillV1 = SyncEntityType._(r'AlbumUserBackfillV1');
static const albumUserDeleteV1 = SyncEntityType._(r'AlbumUserDeleteV1');
static const albumAssetV1 = SyncEntityType._(r'AlbumAssetV1');
static const albumAssetBackfillV1 = SyncEntityType._(r'AlbumAssetBackfillV1');
static const albumAssetExifV1 = SyncEntityType._(r'AlbumAssetExifV1');
static const albumAssetExifBackfillV1 = SyncEntityType._(r'AlbumAssetExifBackfillV1');
static const albumToAssetV1 = SyncEntityType._(r'AlbumToAssetV1');
static const albumToAssetDeleteV1 = SyncEntityType._(r'AlbumToAssetDeleteV1');
static const albumToAssetBackfillV1 = SyncEntityType._(r'AlbumToAssetBackfillV1');
static const syncAckV1 = SyncEntityType._(r'SyncAckV1');
/// List of all possible values in this [enum][SyncEntityType].
@ -61,6 +68,13 @@ class SyncEntityType {
albumUserV1,
albumUserBackfillV1,
albumUserDeleteV1,
albumAssetV1,
albumAssetBackfillV1,
albumAssetExifV1,
albumAssetExifBackfillV1,
albumToAssetV1,
albumToAssetDeleteV1,
albumToAssetBackfillV1,
syncAckV1,
];
@ -117,6 +131,13 @@ class SyncEntityTypeTypeTransformer {
case r'AlbumUserV1': return SyncEntityType.albumUserV1;
case r'AlbumUserBackfillV1': return SyncEntityType.albumUserBackfillV1;
case r'AlbumUserDeleteV1': return SyncEntityType.albumUserDeleteV1;
case r'AlbumAssetV1': return SyncEntityType.albumAssetV1;
case r'AlbumAssetBackfillV1': return SyncEntityType.albumAssetBackfillV1;
case r'AlbumAssetExifV1': return SyncEntityType.albumAssetExifV1;
case r'AlbumAssetExifBackfillV1': return SyncEntityType.albumAssetExifBackfillV1;
case r'AlbumToAssetV1': return SyncEntityType.albumToAssetV1;
case r'AlbumToAssetDeleteV1': return SyncEntityType.albumToAssetDeleteV1;
case r'AlbumToAssetBackfillV1': return SyncEntityType.albumToAssetBackfillV1;
case r'SyncAckV1': return SyncEntityType.syncAckV1;
default:
if (!allowNull) {

View File

@ -31,6 +31,9 @@ class SyncRequestType {
static const partnerAssetExifsV1 = SyncRequestType._(r'PartnerAssetExifsV1');
static const albumsV1 = SyncRequestType._(r'AlbumsV1');
static const albumUsersV1 = SyncRequestType._(r'AlbumUsersV1');
static const albumToAssetsV1 = SyncRequestType._(r'AlbumToAssetsV1');
static const albumAssetsV1 = SyncRequestType._(r'AlbumAssetsV1');
static const albumAssetExifsV1 = SyncRequestType._(r'AlbumAssetExifsV1');
/// List of all possible values in this [enum][SyncRequestType].
static const values = <SyncRequestType>[
@ -42,6 +45,9 @@ class SyncRequestType {
partnerAssetExifsV1,
albumsV1,
albumUsersV1,
albumToAssetsV1,
albumAssetsV1,
albumAssetExifsV1,
];
static SyncRequestType? fromJson(dynamic value) => SyncRequestTypeTypeTransformer().decode(value);
@ -88,6 +94,9 @@ class SyncRequestTypeTypeTransformer {
case r'PartnerAssetExifsV1': return SyncRequestType.partnerAssetExifsV1;
case r'AlbumsV1': return SyncRequestType.albumsV1;
case r'AlbumUsersV1': return SyncRequestType.albumUsersV1;
case r'AlbumToAssetsV1': return SyncRequestType.albumToAssetsV1;
case r'AlbumAssetsV1': return SyncRequestType.albumAssetsV1;
case r'AlbumAssetExifsV1': return SyncRequestType.albumAssetExifsV1;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');