feat: asset face sync (#20048)

* chore: remove thumbnailPath from person sync dto

* feat: asset face sync
This commit is contained in:
Zack Pollard 2025-07-22 02:31:45 +01:00 committed by GitHub
parent 826eaedae6
commit df318ac641
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 699 additions and 20 deletions

View file

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

View file

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

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 assetFaceV1 = SyncEntityType._(r'AssetFaceV1');
static const assetFaceDeleteV1 = SyncEntityType._(r'AssetFaceDeleteV1');
static const userMetadataV1 = SyncEntityType._(r'UserMetadataV1');
static const userMetadataDeleteV1 = SyncEntityType._(r'UserMetadataDeleteV1');
static const syncAckV1 = SyncEntityType._(r'SyncAckV1');
@ -100,6 +102,8 @@ class SyncEntityType {
stackDeleteV1,
personV1,
personDeleteV1,
assetFaceV1,
assetFaceDeleteV1,
userMetadataV1,
userMetadataDeleteV1,
syncAckV1,
@ -177,6 +181,8 @@ class SyncEntityTypeTypeTransformer {
case r'StackDeleteV1': return SyncEntityType.stackDeleteV1;
case r'PersonV1': return SyncEntityType.personV1;
case r'PersonDeleteV1': return SyncEntityType.personDeleteV1;
case r'AssetFaceV1': return SyncEntityType.assetFaceV1;
case r'AssetFaceDeleteV1': return SyncEntityType.assetFaceDeleteV1;
case r'UserMetadataV1': return SyncEntityType.userMetadataV1;
case r'UserMetadataDeleteV1': return SyncEntityType.userMetadataDeleteV1;
case r'SyncAckV1': return SyncEntityType.syncAckV1;

View file

@ -22,7 +22,6 @@ class SyncPersonV1 {
required this.isHidden,
required this.name,
required this.ownerId,
required this.thumbnailPath,
required this.updatedAt,
});
@ -44,8 +43,6 @@ class SyncPersonV1 {
String ownerId;
String thumbnailPath;
DateTime updatedAt;
@override
@ -59,7 +56,6 @@ class SyncPersonV1 {
other.isHidden == isHidden &&
other.name == name &&
other.ownerId == ownerId &&
other.thumbnailPath == thumbnailPath &&
other.updatedAt == updatedAt;
@override
@ -74,11 +70,10 @@ class SyncPersonV1 {
(isHidden.hashCode) +
(name.hashCode) +
(ownerId.hashCode) +
(thumbnailPath.hashCode) +
(updatedAt.hashCode);
@override
String toString() => 'SyncPersonV1[birthDate=$birthDate, color=$color, createdAt=$createdAt, faceAssetId=$faceAssetId, id=$id, isFavorite=$isFavorite, isHidden=$isHidden, name=$name, ownerId=$ownerId, thumbnailPath=$thumbnailPath, updatedAt=$updatedAt]';
String toString() => 'SyncPersonV1[birthDate=$birthDate, color=$color, createdAt=$createdAt, faceAssetId=$faceAssetId, id=$id, isFavorite=$isFavorite, isHidden=$isHidden, name=$name, ownerId=$ownerId, updatedAt=$updatedAt]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -103,7 +98,6 @@ class SyncPersonV1 {
json[r'isHidden'] = this.isHidden;
json[r'name'] = this.name;
json[r'ownerId'] = this.ownerId;
json[r'thumbnailPath'] = this.thumbnailPath;
json[r'updatedAt'] = this.updatedAt.toUtc().toIso8601String();
return json;
}
@ -126,7 +120,6 @@ class SyncPersonV1 {
isHidden: mapValueOfType<bool>(json, r'isHidden')!,
name: mapValueOfType<String>(json, r'name')!,
ownerId: mapValueOfType<String>(json, r'ownerId')!,
thumbnailPath: mapValueOfType<String>(json, r'thumbnailPath')!,
updatedAt: mapDateTime(json, r'updatedAt', r'')!,
);
}
@ -184,7 +177,6 @@ class SyncPersonV1 {
'isHidden',
'name',
'ownerId',
'thumbnailPath',
'updatedAt',
};
}

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 assetFacesV1 = SyncRequestType._(r'AssetFacesV1');
static const userMetadataV1 = SyncRequestType._(r'UserMetadataV1');
/// List of all possible values in this [enum][SyncRequestType].
@ -59,6 +60,7 @@ class SyncRequestType {
stacksV1,
usersV1,
peopleV1,
assetFacesV1,
userMetadataV1,
];
@ -114,6 +116,7 @@ class SyncRequestTypeTypeTransformer {
case r'StacksV1': return SyncRequestType.stacksV1;
case r'UsersV1': return SyncRequestType.usersV1;
case r'PeopleV1': return SyncRequestType.peopleV1;
case r'AssetFacesV1': return SyncRequestType.assetFacesV1;
case r'UserMetadataV1': return SyncRequestType.userMetadataV1;
default:
if (!allowNull) {