1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-15 07:14:42 +02:00

feat: UserMetadata sync (#19882)

* feat: UserMetadata sync

* refactor: sync table filters (#19887)
This commit is contained in:
Daniel Dietzler
2025-07-11 20:19:53 +02:00
committed by GitHub
parent 9e48ae3052
commit df581cc0d5
20 changed files with 653 additions and 50 deletions

View File

@ -58,6 +58,8 @@ class SyncEntityType {
static const stackDeleteV1 = SyncEntityType._(r'StackDeleteV1');
static const personV1 = SyncEntityType._(r'PersonV1');
static const personDeleteV1 = SyncEntityType._(r'PersonDeleteV1');
static const userMetadataV1 = SyncEntityType._(r'UserMetadataV1');
static const userMetadataDeleteV1 = SyncEntityType._(r'UserMetadataDeleteV1');
static const syncAckV1 = SyncEntityType._(r'SyncAckV1');
static const syncResetV1 = SyncEntityType._(r'SyncResetV1');
@ -98,6 +100,8 @@ class SyncEntityType {
stackDeleteV1,
personV1,
personDeleteV1,
userMetadataV1,
userMetadataDeleteV1,
syncAckV1,
syncResetV1,
];
@ -173,6 +177,8 @@ class SyncEntityTypeTypeTransformer {
case r'StackDeleteV1': return SyncEntityType.stackDeleteV1;
case r'PersonV1': return SyncEntityType.personV1;
case r'PersonDeleteV1': return SyncEntityType.personDeleteV1;
case r'UserMetadataV1': return SyncEntityType.userMetadataV1;
case r'UserMetadataDeleteV1': return SyncEntityType.userMetadataDeleteV1;
case r'SyncAckV1': return SyncEntityType.syncAckV1;
case r'SyncResetV1': return SyncEntityType.syncResetV1;
default:

View File

@ -39,6 +39,7 @@ class SyncRequestType {
static const stacksV1 = SyncRequestType._(r'StacksV1');
static const usersV1 = SyncRequestType._(r'UsersV1');
static const peopleV1 = SyncRequestType._(r'PeopleV1');
static const userMetadataV1 = SyncRequestType._(r'UserMetadataV1');
/// List of all possible values in this [enum][SyncRequestType].
static const values = <SyncRequestType>[
@ -58,6 +59,7 @@ class SyncRequestType {
stacksV1,
usersV1,
peopleV1,
userMetadataV1,
];
static SyncRequestType? fromJson(dynamic value) => SyncRequestTypeTypeTransformer().decode(value);
@ -112,6 +114,7 @@ class SyncRequestTypeTypeTransformer {
case r'StacksV1': return SyncRequestType.stacksV1;
case r'UsersV1': return SyncRequestType.usersV1;
case r'PeopleV1': return SyncRequestType.peopleV1;
case r'UserMetadataV1': return SyncRequestType.userMetadataV1;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');

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 SyncUserMetadataDeleteV1 {
/// Returns a new [SyncUserMetadataDeleteV1] instance.
SyncUserMetadataDeleteV1({
required this.key,
required this.userId,
});
String key;
String userId;
@override
bool operator ==(Object other) => identical(this, other) || other is SyncUserMetadataDeleteV1 &&
other.key == key &&
other.userId == userId;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(key.hashCode) +
(userId.hashCode);
@override
String toString() => 'SyncUserMetadataDeleteV1[key=$key, userId=$userId]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'key'] = this.key;
json[r'userId'] = this.userId;
return json;
}
/// Returns a new [SyncUserMetadataDeleteV1] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static SyncUserMetadataDeleteV1? fromJson(dynamic value) {
upgradeDto(value, "SyncUserMetadataDeleteV1");
if (value is Map) {
final json = value.cast<String, dynamic>();
return SyncUserMetadataDeleteV1(
key: mapValueOfType<String>(json, r'key')!,
userId: mapValueOfType<String>(json, r'userId')!,
);
}
return null;
}
static List<SyncUserMetadataDeleteV1> listFromJson(dynamic json, {bool growable = false,}) {
final result = <SyncUserMetadataDeleteV1>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = SyncUserMetadataDeleteV1.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, SyncUserMetadataDeleteV1> mapFromJson(dynamic json) {
final map = <String, SyncUserMetadataDeleteV1>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = SyncUserMetadataDeleteV1.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of SyncUserMetadataDeleteV1-objects as value to a dart map
static Map<String, List<SyncUserMetadataDeleteV1>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<SyncUserMetadataDeleteV1>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = SyncUserMetadataDeleteV1.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'key',
'userId',
};
}

View File

@ -0,0 +1,115 @@
//
// 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 SyncUserMetadataV1 {
/// Returns a new [SyncUserMetadataV1] instance.
SyncUserMetadataV1({
required this.key,
required this.userId,
required this.value,
});
String key;
String userId;
Object value;
@override
bool operator ==(Object other) => identical(this, other) || other is SyncUserMetadataV1 &&
other.key == key &&
other.userId == userId &&
other.value == value;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(key.hashCode) +
(userId.hashCode) +
(value.hashCode);
@override
String toString() => 'SyncUserMetadataV1[key=$key, userId=$userId, value=$value]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'key'] = this.key;
json[r'userId'] = this.userId;
json[r'value'] = this.value;
return json;
}
/// Returns a new [SyncUserMetadataV1] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static SyncUserMetadataV1? fromJson(dynamic value) {
upgradeDto(value, "SyncUserMetadataV1");
if (value is Map) {
final json = value.cast<String, dynamic>();
return SyncUserMetadataV1(
key: mapValueOfType<String>(json, r'key')!,
userId: mapValueOfType<String>(json, r'userId')!,
value: mapValueOfType<Object>(json, r'value')!,
);
}
return null;
}
static List<SyncUserMetadataV1> listFromJson(dynamic json, {bool growable = false,}) {
final result = <SyncUserMetadataV1>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = SyncUserMetadataV1.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, SyncUserMetadataV1> mapFromJson(dynamic json) {
final map = <String, SyncUserMetadataV1>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = SyncUserMetadataV1.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of SyncUserMetadataV1-objects as value to a dart map
static Map<String, List<SyncUserMetadataV1>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<SyncUserMetadataV1>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = SyncUserMetadataV1.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'key',
'userId',
'value',
};
}