1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-17 10:07:48 +02:00

feat(web): email notification preference settings (#9934)

* feat(web): email notification preference settings

* Update

* remove failed api generation file

* fix handle album invite return value

* Update web/src/lib/components/user-settings-page/notifications-settings.svelte

Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com>

* wording

* test

---------

Co-authored-by: Daniel Dietzler <mail@ddietzler.dev>
Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com>
This commit is contained in:
Alex
2024-06-03 16:00:20 -05:00
committed by GitHub
parent 15474e81b2
commit b3ee394fdc
15 changed files with 478 additions and 4 deletions

View File

@ -0,0 +1,114 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.18
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class EmailNotificationsResponse {
/// Returns a new [EmailNotificationsResponse] instance.
EmailNotificationsResponse({
required this.albumInvite,
required this.albumUpdate,
required this.enabled,
});
bool albumInvite;
bool albumUpdate;
bool enabled;
@override
bool operator ==(Object other) => identical(this, other) || other is EmailNotificationsResponse &&
other.albumInvite == albumInvite &&
other.albumUpdate == albumUpdate &&
other.enabled == enabled;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(albumInvite.hashCode) +
(albumUpdate.hashCode) +
(enabled.hashCode);
@override
String toString() => 'EmailNotificationsResponse[albumInvite=$albumInvite, albumUpdate=$albumUpdate, enabled=$enabled]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'albumInvite'] = this.albumInvite;
json[r'albumUpdate'] = this.albumUpdate;
json[r'enabled'] = this.enabled;
return json;
}
/// Returns a new [EmailNotificationsResponse] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static EmailNotificationsResponse? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
return EmailNotificationsResponse(
albumInvite: mapValueOfType<bool>(json, r'albumInvite')!,
albumUpdate: mapValueOfType<bool>(json, r'albumUpdate')!,
enabled: mapValueOfType<bool>(json, r'enabled')!,
);
}
return null;
}
static List<EmailNotificationsResponse> listFromJson(dynamic json, {bool growable = false,}) {
final result = <EmailNotificationsResponse>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = EmailNotificationsResponse.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, EmailNotificationsResponse> mapFromJson(dynamic json) {
final map = <String, EmailNotificationsResponse>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = EmailNotificationsResponse.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of EmailNotificationsResponse-objects as value to a dart map
static Map<String, List<EmailNotificationsResponse>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<EmailNotificationsResponse>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = EmailNotificationsResponse.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'albumInvite',
'albumUpdate',
'enabled',
};
}

View File

@ -0,0 +1,141 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.18
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class EmailNotificationsUpdate {
/// Returns a new [EmailNotificationsUpdate] instance.
EmailNotificationsUpdate({
this.albumInvite,
this.albumUpdate,
this.enabled,
});
///
/// 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.
///
bool? albumInvite;
///
/// 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.
///
bool? albumUpdate;
///
/// 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.
///
bool? enabled;
@override
bool operator ==(Object other) => identical(this, other) || other is EmailNotificationsUpdate &&
other.albumInvite == albumInvite &&
other.albumUpdate == albumUpdate &&
other.enabled == enabled;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(albumInvite == null ? 0 : albumInvite!.hashCode) +
(albumUpdate == null ? 0 : albumUpdate!.hashCode) +
(enabled == null ? 0 : enabled!.hashCode);
@override
String toString() => 'EmailNotificationsUpdate[albumInvite=$albumInvite, albumUpdate=$albumUpdate, enabled=$enabled]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (this.albumInvite != null) {
json[r'albumInvite'] = this.albumInvite;
} else {
// json[r'albumInvite'] = null;
}
if (this.albumUpdate != null) {
json[r'albumUpdate'] = this.albumUpdate;
} else {
// json[r'albumUpdate'] = null;
}
if (this.enabled != null) {
json[r'enabled'] = this.enabled;
} else {
// json[r'enabled'] = null;
}
return json;
}
/// Returns a new [EmailNotificationsUpdate] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static EmailNotificationsUpdate? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
return EmailNotificationsUpdate(
albumInvite: mapValueOfType<bool>(json, r'albumInvite'),
albumUpdate: mapValueOfType<bool>(json, r'albumUpdate'),
enabled: mapValueOfType<bool>(json, r'enabled'),
);
}
return null;
}
static List<EmailNotificationsUpdate> listFromJson(dynamic json, {bool growable = false,}) {
final result = <EmailNotificationsUpdate>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = EmailNotificationsUpdate.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, EmailNotificationsUpdate> mapFromJson(dynamic json) {
final map = <String, EmailNotificationsUpdate>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = EmailNotificationsUpdate.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of EmailNotificationsUpdate-objects as value to a dart map
static Map<String, List<EmailNotificationsUpdate>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<EmailNotificationsUpdate>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = EmailNotificationsUpdate.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
};
}

View File

@ -14,30 +14,36 @@ class UserPreferencesResponseDto {
/// Returns a new [UserPreferencesResponseDto] instance.
UserPreferencesResponseDto({
required this.avatar,
required this.emailNotifications,
required this.memories,
});
AvatarResponse avatar;
EmailNotificationsResponse emailNotifications;
MemoryResponse memories;
@override
bool operator ==(Object other) => identical(this, other) || other is UserPreferencesResponseDto &&
other.avatar == avatar &&
other.emailNotifications == emailNotifications &&
other.memories == memories;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(avatar.hashCode) +
(emailNotifications.hashCode) +
(memories.hashCode);
@override
String toString() => 'UserPreferencesResponseDto[avatar=$avatar, memories=$memories]';
String toString() => 'UserPreferencesResponseDto[avatar=$avatar, emailNotifications=$emailNotifications, memories=$memories]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'avatar'] = this.avatar;
json[r'emailNotifications'] = this.emailNotifications;
json[r'memories'] = this.memories;
return json;
}
@ -51,6 +57,7 @@ class UserPreferencesResponseDto {
return UserPreferencesResponseDto(
avatar: AvatarResponse.fromJson(json[r'avatar'])!,
emailNotifications: EmailNotificationsResponse.fromJson(json[r'emailNotifications'])!,
memories: MemoryResponse.fromJson(json[r'memories'])!,
);
}
@ -100,6 +107,7 @@ class UserPreferencesResponseDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'avatar',
'emailNotifications',
'memories',
};
}

View File

@ -14,6 +14,7 @@ class UserPreferencesUpdateDto {
/// Returns a new [UserPreferencesUpdateDto] instance.
UserPreferencesUpdateDto({
this.avatar,
this.emailNotifications,
this.memories,
});
@ -25,6 +26,14 @@ class UserPreferencesUpdateDto {
///
AvatarUpdate? avatar;
///
/// 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.
///
EmailNotificationsUpdate? emailNotifications;
///
/// 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
@ -36,16 +45,18 @@ class UserPreferencesUpdateDto {
@override
bool operator ==(Object other) => identical(this, other) || other is UserPreferencesUpdateDto &&
other.avatar == avatar &&
other.emailNotifications == emailNotifications &&
other.memories == memories;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(avatar == null ? 0 : avatar!.hashCode) +
(emailNotifications == null ? 0 : emailNotifications!.hashCode) +
(memories == null ? 0 : memories!.hashCode);
@override
String toString() => 'UserPreferencesUpdateDto[avatar=$avatar, memories=$memories]';
String toString() => 'UserPreferencesUpdateDto[avatar=$avatar, emailNotifications=$emailNotifications, memories=$memories]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -54,6 +65,11 @@ class UserPreferencesUpdateDto {
} else {
// json[r'avatar'] = null;
}
if (this.emailNotifications != null) {
json[r'emailNotifications'] = this.emailNotifications;
} else {
// json[r'emailNotifications'] = null;
}
if (this.memories != null) {
json[r'memories'] = this.memories;
} else {
@ -71,6 +87,7 @@ class UserPreferencesUpdateDto {
return UserPreferencesUpdateDto(
avatar: AvatarUpdate.fromJson(json[r'avatar']),
emailNotifications: EmailNotificationsUpdate.fromJson(json[r'emailNotifications']),
memories: MemoryUpdate.fromJson(json[r'memories']),
);
}