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

feat: pending sync reset flag (#19861)

This commit is contained in:
Jason Rasmussen
2025-07-11 09:38:02 -04:00
committed by GitHub
parent 34f0f6c813
commit 4b3a4725c6
28 changed files with 499 additions and 27 deletions

View File

@ -19,6 +19,7 @@ class SessionCreateResponseDto {
required this.deviceType,
this.expiresAt,
required this.id,
required this.isPendingSyncReset,
required this.token,
required this.updatedAt,
});
@ -41,6 +42,8 @@ class SessionCreateResponseDto {
String id;
bool isPendingSyncReset;
String token;
String updatedAt;
@ -53,6 +56,7 @@ class SessionCreateResponseDto {
other.deviceType == deviceType &&
other.expiresAt == expiresAt &&
other.id == id &&
other.isPendingSyncReset == isPendingSyncReset &&
other.token == token &&
other.updatedAt == updatedAt;
@ -65,11 +69,12 @@ class SessionCreateResponseDto {
(deviceType.hashCode) +
(expiresAt == null ? 0 : expiresAt!.hashCode) +
(id.hashCode) +
(isPendingSyncReset.hashCode) +
(token.hashCode) +
(updatedAt.hashCode);
@override
String toString() => 'SessionCreateResponseDto[createdAt=$createdAt, current=$current, deviceOS=$deviceOS, deviceType=$deviceType, expiresAt=$expiresAt, id=$id, token=$token, updatedAt=$updatedAt]';
String toString() => 'SessionCreateResponseDto[createdAt=$createdAt, current=$current, deviceOS=$deviceOS, deviceType=$deviceType, expiresAt=$expiresAt, id=$id, isPendingSyncReset=$isPendingSyncReset, token=$token, updatedAt=$updatedAt]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -83,6 +88,7 @@ class SessionCreateResponseDto {
// json[r'expiresAt'] = null;
}
json[r'id'] = this.id;
json[r'isPendingSyncReset'] = this.isPendingSyncReset;
json[r'token'] = this.token;
json[r'updatedAt'] = this.updatedAt;
return json;
@ -103,6 +109,7 @@ class SessionCreateResponseDto {
deviceType: mapValueOfType<String>(json, r'deviceType')!,
expiresAt: mapValueOfType<String>(json, r'expiresAt'),
id: mapValueOfType<String>(json, r'id')!,
isPendingSyncReset: mapValueOfType<bool>(json, r'isPendingSyncReset')!,
token: mapValueOfType<String>(json, r'token')!,
updatedAt: mapValueOfType<String>(json, r'updatedAt')!,
);
@ -157,6 +164,7 @@ class SessionCreateResponseDto {
'deviceOS',
'deviceType',
'id',
'isPendingSyncReset',
'token',
'updatedAt',
};

View File

@ -19,6 +19,7 @@ class SessionResponseDto {
required this.deviceType,
this.expiresAt,
required this.id,
required this.isPendingSyncReset,
required this.updatedAt,
});
@ -40,6 +41,8 @@ class SessionResponseDto {
String id;
bool isPendingSyncReset;
String updatedAt;
@override
@ -50,6 +53,7 @@ class SessionResponseDto {
other.deviceType == deviceType &&
other.expiresAt == expiresAt &&
other.id == id &&
other.isPendingSyncReset == isPendingSyncReset &&
other.updatedAt == updatedAt;
@override
@ -61,10 +65,11 @@ class SessionResponseDto {
(deviceType.hashCode) +
(expiresAt == null ? 0 : expiresAt!.hashCode) +
(id.hashCode) +
(isPendingSyncReset.hashCode) +
(updatedAt.hashCode);
@override
String toString() => 'SessionResponseDto[createdAt=$createdAt, current=$current, deviceOS=$deviceOS, deviceType=$deviceType, expiresAt=$expiresAt, id=$id, updatedAt=$updatedAt]';
String toString() => 'SessionResponseDto[createdAt=$createdAt, current=$current, deviceOS=$deviceOS, deviceType=$deviceType, expiresAt=$expiresAt, id=$id, isPendingSyncReset=$isPendingSyncReset, updatedAt=$updatedAt]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -78,6 +83,7 @@ class SessionResponseDto {
// json[r'expiresAt'] = null;
}
json[r'id'] = this.id;
json[r'isPendingSyncReset'] = this.isPendingSyncReset;
json[r'updatedAt'] = this.updatedAt;
return json;
}
@ -97,6 +103,7 @@ class SessionResponseDto {
deviceType: mapValueOfType<String>(json, r'deviceType')!,
expiresAt: mapValueOfType<String>(json, r'expiresAt'),
id: mapValueOfType<String>(json, r'id')!,
isPendingSyncReset: mapValueOfType<bool>(json, r'isPendingSyncReset')!,
updatedAt: mapValueOfType<String>(json, r'updatedAt')!,
);
}
@ -150,6 +157,7 @@ class SessionResponseDto {
'deviceOS',
'deviceType',
'id',
'isPendingSyncReset',
'updatedAt',
};
}

View File

@ -0,0 +1,108 @@
//
// 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 SessionUpdateDto {
/// Returns a new [SessionUpdateDto] instance.
SessionUpdateDto({
this.isPendingSyncReset,
});
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
bool? isPendingSyncReset;
@override
bool operator ==(Object other) => identical(this, other) || other is SessionUpdateDto &&
other.isPendingSyncReset == isPendingSyncReset;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(isPendingSyncReset == null ? 0 : isPendingSyncReset!.hashCode);
@override
String toString() => 'SessionUpdateDto[isPendingSyncReset=$isPendingSyncReset]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (this.isPendingSyncReset != null) {
json[r'isPendingSyncReset'] = this.isPendingSyncReset;
} else {
// json[r'isPendingSyncReset'] = null;
}
return json;
}
/// Returns a new [SessionUpdateDto] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static SessionUpdateDto? fromJson(dynamic value) {
upgradeDto(value, "SessionUpdateDto");
if (value is Map) {
final json = value.cast<String, dynamic>();
return SessionUpdateDto(
isPendingSyncReset: mapValueOfType<bool>(json, r'isPendingSyncReset'),
);
}
return null;
}
static List<SessionUpdateDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <SessionUpdateDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = SessionUpdateDto.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, SessionUpdateDto> mapFromJson(dynamic json) {
final map = <String, SessionUpdateDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = SessionUpdateDto.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of SessionUpdateDto-objects as value to a dart map
static Map<String, List<SessionUpdateDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<SessionUpdateDto>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = SessionUpdateDto.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
};
}

View File

@ -59,6 +59,7 @@ class SyncEntityType {
static const personV1 = SyncEntityType._(r'PersonV1');
static const personDeleteV1 = SyncEntityType._(r'PersonDeleteV1');
static const syncAckV1 = SyncEntityType._(r'SyncAckV1');
static const syncResetV1 = SyncEntityType._(r'SyncResetV1');
/// List of all possible values in this [enum][SyncEntityType].
static const values = <SyncEntityType>[
@ -98,6 +99,7 @@ class SyncEntityType {
personV1,
personDeleteV1,
syncAckV1,
syncResetV1,
];
static SyncEntityType? fromJson(dynamic value) => SyncEntityTypeTypeTransformer().decode(value);
@ -172,6 +174,7 @@ class SyncEntityTypeTypeTransformer {
case r'PersonV1': return SyncEntityType.personV1;
case r'PersonDeleteV1': return SyncEntityType.personDeleteV1;
case r'SyncAckV1': return SyncEntityType.syncAckV1;
case r'SyncResetV1': return SyncEntityType.syncResetV1;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');

View File

@ -13,25 +13,41 @@ part of openapi.api;
class SyncStreamDto {
/// Returns a new [SyncStreamDto] instance.
SyncStreamDto({
this.reset,
this.types = const [],
});
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
bool? reset;
List<SyncRequestType> types;
@override
bool operator ==(Object other) => identical(this, other) || other is SyncStreamDto &&
other.reset == reset &&
_deepEquality.equals(other.types, types);
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(reset == null ? 0 : reset!.hashCode) +
(types.hashCode);
@override
String toString() => 'SyncStreamDto[types=$types]';
String toString() => 'SyncStreamDto[reset=$reset, types=$types]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (this.reset != null) {
json[r'reset'] = this.reset;
} else {
// json[r'reset'] = null;
}
json[r'types'] = this.types;
return json;
}
@ -45,6 +61,7 @@ class SyncStreamDto {
final json = value.cast<String, dynamic>();
return SyncStreamDto(
reset: mapValueOfType<bool>(json, r'reset'),
types: SyncRequestType.listFromJson(json[r'types']),
);
}