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

feat(web): add a user setting for default album sort order. (#18950)

* Add a user setting for default album sort order.

Add a user setting under "Features" to control the initial sort order
when creating an album. Default to the existing behavior of
"newest first".

* chore: patch openapi

---------

Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
Dag Stuan
2025-06-06 06:31:34 +02:00
committed by GitHub
parent 55f4e93456
commit b46e066cc2
18 changed files with 397 additions and 13 deletions

View File

@ -78,6 +78,8 @@ part 'model/album_user_add_dto.dart';
part 'model/album_user_create_dto.dart';
part 'model/album_user_response_dto.dart';
part 'model/album_user_role.dart';
part 'model/albums_response.dart';
part 'model/albums_update.dart';
part 'model/all_job_status_response_dto.dart';
part 'model/asset_bulk_delete_dto.dart';
part 'model/asset_bulk_update_dto.dart';

View File

@ -212,6 +212,10 @@ class ApiClient {
return AlbumUserResponseDto.fromJson(value);
case 'AlbumUserRole':
return AlbumUserRoleTypeTransformer().decode(value);
case 'AlbumsResponse':
return AlbumsResponse.fromJson(value);
case 'AlbumsUpdate':
return AlbumsUpdate.fromJson(value);
case 'AllJobStatusResponseDto':
return AllJobStatusResponseDto.fromJson(value);
case 'AssetBulkDeleteDto':

View File

@ -0,0 +1,99 @@
//
// 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 AlbumsResponse {
/// Returns a new [AlbumsResponse] instance.
AlbumsResponse({
this.defaultAssetOrder = AssetOrder.desc,
});
AssetOrder defaultAssetOrder;
@override
bool operator ==(Object other) => identical(this, other) || other is AlbumsResponse &&
other.defaultAssetOrder == defaultAssetOrder;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(defaultAssetOrder.hashCode);
@override
String toString() => 'AlbumsResponse[defaultAssetOrder=$defaultAssetOrder]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'defaultAssetOrder'] = this.defaultAssetOrder;
return json;
}
/// Returns a new [AlbumsResponse] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AlbumsResponse? fromJson(dynamic value) {
upgradeDto(value, "AlbumsResponse");
if (value is Map) {
final json = value.cast<String, dynamic>();
return AlbumsResponse(
defaultAssetOrder: AssetOrder.fromJson(json[r'defaultAssetOrder'])!,
);
}
return null;
}
static List<AlbumsResponse> listFromJson(dynamic json, {bool growable = false,}) {
final result = <AlbumsResponse>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = AlbumsResponse.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, AlbumsResponse> mapFromJson(dynamic json) {
final map = <String, AlbumsResponse>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = AlbumsResponse.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of AlbumsResponse-objects as value to a dart map
static Map<String, List<AlbumsResponse>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<AlbumsResponse>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = AlbumsResponse.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'defaultAssetOrder',
};
}

View File

@ -0,0 +1,108 @@
//
// 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 AlbumsUpdate {
/// Returns a new [AlbumsUpdate] instance.
AlbumsUpdate({
this.defaultAssetOrder,
});
///
/// 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.
///
AssetOrder? defaultAssetOrder;
@override
bool operator ==(Object other) => identical(this, other) || other is AlbumsUpdate &&
other.defaultAssetOrder == defaultAssetOrder;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(defaultAssetOrder == null ? 0 : defaultAssetOrder!.hashCode);
@override
String toString() => 'AlbumsUpdate[defaultAssetOrder=$defaultAssetOrder]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (this.defaultAssetOrder != null) {
json[r'defaultAssetOrder'] = this.defaultAssetOrder;
} else {
// json[r'defaultAssetOrder'] = null;
}
return json;
}
/// Returns a new [AlbumsUpdate] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AlbumsUpdate? fromJson(dynamic value) {
upgradeDto(value, "AlbumsUpdate");
if (value is Map) {
final json = value.cast<String, dynamic>();
return AlbumsUpdate(
defaultAssetOrder: AssetOrder.fromJson(json[r'defaultAssetOrder']),
);
}
return null;
}
static List<AlbumsUpdate> listFromJson(dynamic json, {bool growable = false,}) {
final result = <AlbumsUpdate>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = AlbumsUpdate.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, AlbumsUpdate> mapFromJson(dynamic json) {
final map = <String, AlbumsUpdate>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = AlbumsUpdate.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of AlbumsUpdate-objects as value to a dart map
static Map<String, List<AlbumsUpdate>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<AlbumsUpdate>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = AlbumsUpdate.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

@ -13,6 +13,7 @@ part of openapi.api;
class UserPreferencesResponseDto {
/// Returns a new [UserPreferencesResponseDto] instance.
UserPreferencesResponseDto({
required this.albums,
required this.cast,
required this.download,
required this.emailNotifications,
@ -25,6 +26,8 @@ class UserPreferencesResponseDto {
required this.tags,
});
AlbumsResponse albums;
CastResponse cast;
DownloadResponse download;
@ -47,6 +50,7 @@ class UserPreferencesResponseDto {
@override
bool operator ==(Object other) => identical(this, other) || other is UserPreferencesResponseDto &&
other.albums == albums &&
other.cast == cast &&
other.download == download &&
other.emailNotifications == emailNotifications &&
@ -61,6 +65,7 @@ class UserPreferencesResponseDto {
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(albums.hashCode) +
(cast.hashCode) +
(download.hashCode) +
(emailNotifications.hashCode) +
@ -73,10 +78,11 @@ class UserPreferencesResponseDto {
(tags.hashCode);
@override
String toString() => 'UserPreferencesResponseDto[cast=$cast, download=$download, emailNotifications=$emailNotifications, folders=$folders, memories=$memories, people=$people, purchase=$purchase, ratings=$ratings, sharedLinks=$sharedLinks, tags=$tags]';
String toString() => 'UserPreferencesResponseDto[albums=$albums, cast=$cast, download=$download, emailNotifications=$emailNotifications, folders=$folders, memories=$memories, people=$people, purchase=$purchase, ratings=$ratings, sharedLinks=$sharedLinks, tags=$tags]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'albums'] = this.albums;
json[r'cast'] = this.cast;
json[r'download'] = this.download;
json[r'emailNotifications'] = this.emailNotifications;
@ -99,6 +105,7 @@ class UserPreferencesResponseDto {
final json = value.cast<String, dynamic>();
return UserPreferencesResponseDto(
albums: AlbumsResponse.fromJson(json[r'albums'])!,
cast: CastResponse.fromJson(json[r'cast'])!,
download: DownloadResponse.fromJson(json[r'download'])!,
emailNotifications: EmailNotificationsResponse.fromJson(json[r'emailNotifications'])!,
@ -156,6 +163,7 @@ class UserPreferencesResponseDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'albums',
'cast',
'download',
'emailNotifications',

View File

@ -13,6 +13,7 @@ part of openapi.api;
class UserPreferencesUpdateDto {
/// Returns a new [UserPreferencesUpdateDto] instance.
UserPreferencesUpdateDto({
this.albums,
this.avatar,
this.cast,
this.download,
@ -26,6 +27,14 @@ class UserPreferencesUpdateDto {
this.tags,
});
///
/// 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.
///
AlbumsUpdate? albums;
///
/// 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
@ -116,6 +125,7 @@ class UserPreferencesUpdateDto {
@override
bool operator ==(Object other) => identical(this, other) || other is UserPreferencesUpdateDto &&
other.albums == albums &&
other.avatar == avatar &&
other.cast == cast &&
other.download == download &&
@ -131,6 +141,7 @@ class UserPreferencesUpdateDto {
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(albums == null ? 0 : albums!.hashCode) +
(avatar == null ? 0 : avatar!.hashCode) +
(cast == null ? 0 : cast!.hashCode) +
(download == null ? 0 : download!.hashCode) +
@ -144,10 +155,15 @@ class UserPreferencesUpdateDto {
(tags == null ? 0 : tags!.hashCode);
@override
String toString() => 'UserPreferencesUpdateDto[avatar=$avatar, cast=$cast, download=$download, emailNotifications=$emailNotifications, folders=$folders, memories=$memories, people=$people, purchase=$purchase, ratings=$ratings, sharedLinks=$sharedLinks, tags=$tags]';
String toString() => 'UserPreferencesUpdateDto[albums=$albums, avatar=$avatar, cast=$cast, download=$download, emailNotifications=$emailNotifications, folders=$folders, memories=$memories, people=$people, purchase=$purchase, ratings=$ratings, sharedLinks=$sharedLinks, tags=$tags]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (this.albums != null) {
json[r'albums'] = this.albums;
} else {
// json[r'albums'] = null;
}
if (this.avatar != null) {
json[r'avatar'] = this.avatar;
} else {
@ -215,6 +231,7 @@ class UserPreferencesUpdateDto {
final json = value.cast<String, dynamic>();
return UserPreferencesUpdateDto(
albums: AlbumsUpdate.fromJson(json[r'albums']),
avatar: AvatarUpdate.fromJson(json[r'avatar']),
cast: CastUpdate.fromJson(json[r'cast']),
download: DownloadUpdate.fromJson(json[r'download']),