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

@ -12,16 +12,40 @@ class AvatarUpdate {
color?: UserAvatarColor;
}
class MemoryUpdate {
class MemoriesUpdate {
@ValidateBoolean({ optional: true })
enabled?: boolean;
}
class RatingUpdate {
class RatingsUpdate {
@ValidateBoolean({ optional: true })
enabled?: boolean;
}
class FoldersUpdate {
@ValidateBoolean({ optional: true })
enabled?: boolean;
@ValidateBoolean({ optional: true })
sidebarWeb?: boolean;
}
class PeopleUpdate {
@ValidateBoolean({ optional: true })
enabled?: boolean;
@ValidateBoolean({ optional: true })
sidebarWeb?: boolean;
}
class TagsUpdate {
@ValidateBoolean({ optional: true })
enabled?: boolean;
@ValidateBoolean({ optional: true })
sidebarWeb?: boolean;
}
class EmailNotificationsUpdate {
@ValidateBoolean({ optional: true })
enabled?: boolean;
@ -56,19 +80,34 @@ class PurchaseUpdate {
export class UserPreferencesUpdateDto {
@Optional()
@ValidateNested()
@Type(() => RatingUpdate)
rating?: RatingUpdate;
@Type(() => FoldersUpdate)
folders?: FoldersUpdate;
@Optional()
@ValidateNested()
@Type(() => MemoriesUpdate)
memories?: MemoriesUpdate;
@Optional()
@ValidateNested()
@Type(() => PeopleUpdate)
people?: PeopleUpdate;
@Optional()
@ValidateNested()
@Type(() => RatingsUpdate)
ratings?: RatingsUpdate;
@Optional()
@ValidateNested()
@Type(() => TagsUpdate)
tags?: TagsUpdate;
@Optional()
@ValidateNested()
@Type(() => AvatarUpdate)
avatar?: AvatarUpdate;
@Optional()
@ValidateNested()
@Type(() => MemoryUpdate)
memories?: MemoryUpdate;
@Optional()
@ValidateNested()
@Type(() => EmailNotificationsUpdate)
@ -90,12 +129,27 @@ class AvatarResponse {
color!: UserAvatarColor;
}
class RatingResponse {
class RatingsResponse {
enabled: boolean = false;
}
class MemoryResponse {
enabled!: boolean;
class MemoriesResponse {
enabled: boolean = true;
}
class FoldersResponse {
enabled: boolean = false;
sidebarWeb: boolean = false;
}
class PeopleResponse {
enabled: boolean = true;
sidebarWeb: boolean = false;
}
class TagsResponse {
enabled: boolean = true;
sidebarWeb: boolean = true;
}
class EmailNotificationsResponse {
@ -117,8 +171,11 @@ class PurchaseResponse {
}
export class UserPreferencesResponseDto implements UserPreferences {
rating!: RatingResponse;
memories!: MemoryResponse;
folders!: FoldersResponse;
memories!: MemoriesResponse;
people!: PeopleResponse;
ratings!: RatingsResponse;
tags!: TagsResponse;
avatar!: AvatarResponse;
emailNotifications!: EmailNotificationsResponse;
download!: DownloadResponse;