You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-07-17 15:47:54 +02:00
fix: ensure manually tagged faces have proper source type (#16364)
immich-app/immich#16062 added manual face tagging and deletion, but did not add a new 'SourceType'. The create faces would default to 'machine-learning' which is incorrect, and has the annoying downside that they will be wiped when the 'Refresh Faces' job is run. Handling of non-machine-learning faces was previously added in immich-app/immich#6455. This PR simply extends it to the new manually tagged faces.
This commit is contained in:
10
mobile/openapi/lib/model/asset_face_create_dto.dart
generated
10
mobile/openapi/lib/model/asset_face_create_dto.dart
generated
@ -18,6 +18,7 @@ class AssetFaceCreateDto {
|
||||
required this.imageHeight,
|
||||
required this.imageWidth,
|
||||
required this.personId,
|
||||
this.sourceType = SourceType.manual,
|
||||
required this.width,
|
||||
required this.x,
|
||||
required this.y,
|
||||
@ -33,6 +34,8 @@ class AssetFaceCreateDto {
|
||||
|
||||
String personId;
|
||||
|
||||
SourceType sourceType;
|
||||
|
||||
int width;
|
||||
|
||||
int x;
|
||||
@ -46,6 +49,7 @@ class AssetFaceCreateDto {
|
||||
other.imageHeight == imageHeight &&
|
||||
other.imageWidth == imageWidth &&
|
||||
other.personId == personId &&
|
||||
other.sourceType == sourceType &&
|
||||
other.width == width &&
|
||||
other.x == x &&
|
||||
other.y == y;
|
||||
@ -58,12 +62,13 @@ class AssetFaceCreateDto {
|
||||
(imageHeight.hashCode) +
|
||||
(imageWidth.hashCode) +
|
||||
(personId.hashCode) +
|
||||
(sourceType.hashCode) +
|
||||
(width.hashCode) +
|
||||
(x.hashCode) +
|
||||
(y.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'AssetFaceCreateDto[assetId=$assetId, height=$height, imageHeight=$imageHeight, imageWidth=$imageWidth, personId=$personId, width=$width, x=$x, y=$y]';
|
||||
String toString() => 'AssetFaceCreateDto[assetId=$assetId, height=$height, imageHeight=$imageHeight, imageWidth=$imageWidth, personId=$personId, sourceType=$sourceType, width=$width, x=$x, y=$y]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -72,6 +77,7 @@ class AssetFaceCreateDto {
|
||||
json[r'imageHeight'] = this.imageHeight;
|
||||
json[r'imageWidth'] = this.imageWidth;
|
||||
json[r'personId'] = this.personId;
|
||||
json[r'sourceType'] = this.sourceType;
|
||||
json[r'width'] = this.width;
|
||||
json[r'x'] = this.x;
|
||||
json[r'y'] = this.y;
|
||||
@ -92,6 +98,7 @@ class AssetFaceCreateDto {
|
||||
imageHeight: mapValueOfType<int>(json, r'imageHeight')!,
|
||||
imageWidth: mapValueOfType<int>(json, r'imageWidth')!,
|
||||
personId: mapValueOfType<String>(json, r'personId')!,
|
||||
sourceType: SourceType.fromJson(json[r'sourceType'])!,
|
||||
width: mapValueOfType<int>(json, r'width')!,
|
||||
x: mapValueOfType<int>(json, r'x')!,
|
||||
y: mapValueOfType<int>(json, r'y')!,
|
||||
@ -147,6 +154,7 @@ class AssetFaceCreateDto {
|
||||
'imageHeight',
|
||||
'imageWidth',
|
||||
'personId',
|
||||
'sourceType',
|
||||
'width',
|
||||
'x',
|
||||
'y',
|
||||
|
3
mobile/openapi/lib/model/source_type.dart
generated
3
mobile/openapi/lib/model/source_type.dart
generated
@ -25,11 +25,13 @@ class SourceType {
|
||||
|
||||
static const machineLearning = SourceType._(r'machine-learning');
|
||||
static const exif = SourceType._(r'exif');
|
||||
static const manual = SourceType._(r'manual');
|
||||
|
||||
/// List of all possible values in this [enum][SourceType].
|
||||
static const values = <SourceType>[
|
||||
machineLearning,
|
||||
exif,
|
||||
manual,
|
||||
];
|
||||
|
||||
static SourceType? fromJson(dynamic value) => SourceTypeTypeTransformer().decode(value);
|
||||
@ -70,6 +72,7 @@ class SourceTypeTypeTransformer {
|
||||
switch (data) {
|
||||
case r'machine-learning': return SourceType.machineLearning;
|
||||
case r'exif': return SourceType.exif;
|
||||
case r'manual': return SourceType.manual;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
|
Reference in New Issue
Block a user