mirror of
https://github.com/immich-app/immich.git
synced 2025-12-07 19:53:59 +09:00
feat: user's features preferences (#12099)
* feat: metadata in UserPreference * feat: web metadata settings * feat: web metadata settings * fix: typo * patch openapi * fix: missing translation key * new organization of preference strucutre * feature settings on web * localization * added and used feature settings * add default value to response dto * patch openapi * format en.json file * implement helper method * use tags preference logic * Fix logic bug and add tests * fix preference can be null in detail panel
This commit is contained in:
@@ -16,9 +16,12 @@ class UserPreferencesUpdateDto {
|
||||
this.avatar,
|
||||
this.download,
|
||||
this.emailNotifications,
|
||||
this.folders,
|
||||
this.memories,
|
||||
this.people,
|
||||
this.purchase,
|
||||
this.rating,
|
||||
this.ratings,
|
||||
this.tags,
|
||||
});
|
||||
|
||||
///
|
||||
@@ -51,7 +54,23 @@ class UserPreferencesUpdateDto {
|
||||
/// source code must fall back to having a nullable type.
|
||||
/// Consider adding a "default:" property in the specification file to hide this note.
|
||||
///
|
||||
MemoryUpdate? memories;
|
||||
FoldersUpdate? folders;
|
||||
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
MemoriesUpdate? memories;
|
||||
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
PeopleUpdate? people;
|
||||
|
||||
///
|
||||
/// Please note: This property should have been non-nullable! Since the specification file
|
||||
@@ -67,16 +86,27 @@ class UserPreferencesUpdateDto {
|
||||
/// source code must fall back to having a nullable type.
|
||||
/// Consider adding a "default:" property in the specification file to hide this note.
|
||||
///
|
||||
RatingUpdate? rating;
|
||||
RatingsUpdate? ratings;
|
||||
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
TagsUpdate? tags;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is UserPreferencesUpdateDto &&
|
||||
other.avatar == avatar &&
|
||||
other.download == download &&
|
||||
other.emailNotifications == emailNotifications &&
|
||||
other.folders == folders &&
|
||||
other.memories == memories &&
|
||||
other.people == people &&
|
||||
other.purchase == purchase &&
|
||||
other.rating == rating;
|
||||
other.ratings == ratings &&
|
||||
other.tags == tags;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
@@ -84,12 +114,15 @@ class UserPreferencesUpdateDto {
|
||||
(avatar == null ? 0 : avatar!.hashCode) +
|
||||
(download == null ? 0 : download!.hashCode) +
|
||||
(emailNotifications == null ? 0 : emailNotifications!.hashCode) +
|
||||
(folders == null ? 0 : folders!.hashCode) +
|
||||
(memories == null ? 0 : memories!.hashCode) +
|
||||
(people == null ? 0 : people!.hashCode) +
|
||||
(purchase == null ? 0 : purchase!.hashCode) +
|
||||
(rating == null ? 0 : rating!.hashCode);
|
||||
(ratings == null ? 0 : ratings!.hashCode) +
|
||||
(tags == null ? 0 : tags!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'UserPreferencesUpdateDto[avatar=$avatar, download=$download, emailNotifications=$emailNotifications, memories=$memories, purchase=$purchase, rating=$rating]';
|
||||
String toString() => 'UserPreferencesUpdateDto[avatar=$avatar, download=$download, emailNotifications=$emailNotifications, folders=$folders, memories=$memories, people=$people, purchase=$purchase, ratings=$ratings, tags=$tags]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@@ -108,20 +141,35 @@ class UserPreferencesUpdateDto {
|
||||
} else {
|
||||
// json[r'emailNotifications'] = null;
|
||||
}
|
||||
if (this.folders != null) {
|
||||
json[r'folders'] = this.folders;
|
||||
} else {
|
||||
// json[r'folders'] = null;
|
||||
}
|
||||
if (this.memories != null) {
|
||||
json[r'memories'] = this.memories;
|
||||
} else {
|
||||
// json[r'memories'] = null;
|
||||
}
|
||||
if (this.people != null) {
|
||||
json[r'people'] = this.people;
|
||||
} else {
|
||||
// json[r'people'] = null;
|
||||
}
|
||||
if (this.purchase != null) {
|
||||
json[r'purchase'] = this.purchase;
|
||||
} else {
|
||||
// json[r'purchase'] = null;
|
||||
}
|
||||
if (this.rating != null) {
|
||||
json[r'rating'] = this.rating;
|
||||
if (this.ratings != null) {
|
||||
json[r'ratings'] = this.ratings;
|
||||
} else {
|
||||
// json[r'rating'] = null;
|
||||
// json[r'ratings'] = null;
|
||||
}
|
||||
if (this.tags != null) {
|
||||
json[r'tags'] = this.tags;
|
||||
} else {
|
||||
// json[r'tags'] = null;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
@@ -137,9 +185,12 @@ class UserPreferencesUpdateDto {
|
||||
avatar: AvatarUpdate.fromJson(json[r'avatar']),
|
||||
download: DownloadUpdate.fromJson(json[r'download']),
|
||||
emailNotifications: EmailNotificationsUpdate.fromJson(json[r'emailNotifications']),
|
||||
memories: MemoryUpdate.fromJson(json[r'memories']),
|
||||
folders: FoldersUpdate.fromJson(json[r'folders']),
|
||||
memories: MemoriesUpdate.fromJson(json[r'memories']),
|
||||
people: PeopleUpdate.fromJson(json[r'people']),
|
||||
purchase: PurchaseUpdate.fromJson(json[r'purchase']),
|
||||
rating: RatingUpdate.fromJson(json[r'rating']),
|
||||
ratings: RatingsUpdate.fromJson(json[r'ratings']),
|
||||
tags: TagsUpdate.fromJson(json[r'tags']),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user