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:
Alex 2024-08-29 14:29:04 -05:00 committed by GitHub
parent 9bfaa525db
commit ebecb60f39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 1418 additions and 296 deletions

View file

@ -16,9 +16,12 @@ class UserPreferencesResponseDto {
required this.avatar,
required this.download,
required this.emailNotifications,
required this.folders,
required this.memories,
required this.people,
required this.purchase,
required this.rating,
required this.ratings,
required this.tags,
});
AvatarResponse avatar;
@ -27,20 +30,29 @@ class UserPreferencesResponseDto {
EmailNotificationsResponse emailNotifications;
MemoryResponse memories;
FoldersResponse folders;
MemoriesResponse memories;
PeopleResponse people;
PurchaseResponse purchase;
RatingResponse rating;
RatingsResponse ratings;
TagsResponse tags;
@override
bool operator ==(Object other) => identical(this, other) || other is UserPreferencesResponseDto &&
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 =>
@ -48,21 +60,27 @@ class UserPreferencesResponseDto {
(avatar.hashCode) +
(download.hashCode) +
(emailNotifications.hashCode) +
(folders.hashCode) +
(memories.hashCode) +
(people.hashCode) +
(purchase.hashCode) +
(rating.hashCode);
(ratings.hashCode) +
(tags.hashCode);
@override
String toString() => 'UserPreferencesResponseDto[avatar=$avatar, download=$download, emailNotifications=$emailNotifications, memories=$memories, purchase=$purchase, rating=$rating]';
String toString() => 'UserPreferencesResponseDto[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>{};
json[r'avatar'] = this.avatar;
json[r'download'] = this.download;
json[r'emailNotifications'] = this.emailNotifications;
json[r'folders'] = this.folders;
json[r'memories'] = this.memories;
json[r'people'] = this.people;
json[r'purchase'] = this.purchase;
json[r'rating'] = this.rating;
json[r'ratings'] = this.ratings;
json[r'tags'] = this.tags;
return json;
}
@ -77,9 +95,12 @@ class UserPreferencesResponseDto {
avatar: AvatarResponse.fromJson(json[r'avatar'])!,
download: DownloadResponse.fromJson(json[r'download'])!,
emailNotifications: EmailNotificationsResponse.fromJson(json[r'emailNotifications'])!,
memories: MemoryResponse.fromJson(json[r'memories'])!,
folders: FoldersResponse.fromJson(json[r'folders'])!,
memories: MemoriesResponse.fromJson(json[r'memories'])!,
people: PeopleResponse.fromJson(json[r'people'])!,
purchase: PurchaseResponse.fromJson(json[r'purchase'])!,
rating: RatingResponse.fromJson(json[r'rating'])!,
ratings: RatingsResponse.fromJson(json[r'ratings'])!,
tags: TagsResponse.fromJson(json[r'tags'])!,
);
}
return null;
@ -130,9 +151,12 @@ class UserPreferencesResponseDto {
'avatar',
'download',
'emailNotifications',
'folders',
'memories',
'people',
'purchase',
'rating',
'ratings',
'tags',
};
}