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

feat(api): set person color (#15937)

This commit is contained in:
Jason Rasmussen
2025-02-07 10:06:58 -05:00
committed by GitHub
parent 2e5007adef
commit 23014c263b
18 changed files with 182 additions and 21 deletions

View File

@ -14,6 +14,7 @@ class PeopleUpdateItem {
/// Returns a new [PeopleUpdateItem] instance.
PeopleUpdateItem({
this.birthDate,
this.color,
this.featureFaceAssetId,
required this.id,
this.isFavorite,
@ -24,6 +25,8 @@ class PeopleUpdateItem {
/// Person date of birth. Note: the mobile app cannot currently set the birth date to null.
DateTime? birthDate;
String? color;
/// Asset is used to get the feature face thumbnail.
///
/// Please note: This property should have been non-nullable! Since the specification file
@ -65,6 +68,7 @@ class PeopleUpdateItem {
@override
bool operator ==(Object other) => identical(this, other) || other is PeopleUpdateItem &&
other.birthDate == birthDate &&
other.color == color &&
other.featureFaceAssetId == featureFaceAssetId &&
other.id == id &&
other.isFavorite == isFavorite &&
@ -75,6 +79,7 @@ class PeopleUpdateItem {
int get hashCode =>
// ignore: unnecessary_parenthesis
(birthDate == null ? 0 : birthDate!.hashCode) +
(color == null ? 0 : color!.hashCode) +
(featureFaceAssetId == null ? 0 : featureFaceAssetId!.hashCode) +
(id.hashCode) +
(isFavorite == null ? 0 : isFavorite!.hashCode) +
@ -82,7 +87,7 @@ class PeopleUpdateItem {
(name == null ? 0 : name!.hashCode);
@override
String toString() => 'PeopleUpdateItem[birthDate=$birthDate, featureFaceAssetId=$featureFaceAssetId, id=$id, isFavorite=$isFavorite, isHidden=$isHidden, name=$name]';
String toString() => 'PeopleUpdateItem[birthDate=$birthDate, color=$color, featureFaceAssetId=$featureFaceAssetId, id=$id, isFavorite=$isFavorite, isHidden=$isHidden, name=$name]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -91,6 +96,11 @@ class PeopleUpdateItem {
} else {
// json[r'birthDate'] = null;
}
if (this.color != null) {
json[r'color'] = this.color;
} else {
// json[r'color'] = null;
}
if (this.featureFaceAssetId != null) {
json[r'featureFaceAssetId'] = this.featureFaceAssetId;
} else {
@ -125,6 +135,7 @@ class PeopleUpdateItem {
return PeopleUpdateItem(
birthDate: mapDateTime(json, r'birthDate', r''),
color: mapValueOfType<String>(json, r'color'),
featureFaceAssetId: mapValueOfType<String>(json, r'featureFaceAssetId'),
id: mapValueOfType<String>(json, r'id')!,
isFavorite: mapValueOfType<bool>(json, r'isFavorite'),