1
0
mirror of https://github.com/immich-app/immich.git synced 2025-10-31 00:18:28 +02:00

feat(web): Add album sorting to albums view (#2861)

* Add album sorting to web albums view

* generate api

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
Krisjanis Lejejs
2023-06-21 04:00:59 +03:00
committed by GitHub
parent 3c5fefde2e
commit 746ca5d5ed
11 changed files with 105 additions and 14 deletions

View File

@@ -19,6 +19,7 @@ Name | Type | Description | Notes
**sharedUsers** | [**List<UserResponseDto>**](UserResponseDto.md) | | [default to const []]
**assets** | [**List<AssetResponseDto>**](AssetResponseDto.md) | | [default to const []]
**owner** | [**UserResponseDto**](UserResponseDto.md) | |
**lastModifiedAssetTimestamp** | [**DateTime**](DateTime.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -24,6 +24,7 @@ class AlbumResponseDto {
this.sharedUsers = const [],
this.assets = const [],
required this.owner,
this.lastModifiedAssetTimestamp,
});
int assetCount;
@@ -48,6 +49,14 @@ class AlbumResponseDto {
UserResponseDto owner;
///
/// 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.
///
DateTime? lastModifiedAssetTimestamp;
@override
bool operator ==(Object other) => identical(this, other) || other is AlbumResponseDto &&
other.assetCount == assetCount &&
@@ -60,7 +69,8 @@ class AlbumResponseDto {
other.shared == shared &&
other.sharedUsers == sharedUsers &&
other.assets == assets &&
other.owner == owner;
other.owner == owner &&
other.lastModifiedAssetTimestamp == lastModifiedAssetTimestamp;
@override
int get hashCode =>
@@ -75,10 +85,11 @@ class AlbumResponseDto {
(shared.hashCode) +
(sharedUsers.hashCode) +
(assets.hashCode) +
(owner.hashCode);
(owner.hashCode) +
(lastModifiedAssetTimestamp == null ? 0 : lastModifiedAssetTimestamp!.hashCode);
@override
String toString() => 'AlbumResponseDto[assetCount=$assetCount, id=$id, ownerId=$ownerId, albumName=$albumName, createdAt=$createdAt, updatedAt=$updatedAt, albumThumbnailAssetId=$albumThumbnailAssetId, shared=$shared, sharedUsers=$sharedUsers, assets=$assets, owner=$owner]';
String toString() => 'AlbumResponseDto[assetCount=$assetCount, id=$id, ownerId=$ownerId, albumName=$albumName, createdAt=$createdAt, updatedAt=$updatedAt, albumThumbnailAssetId=$albumThumbnailAssetId, shared=$shared, sharedUsers=$sharedUsers, assets=$assets, owner=$owner, lastModifiedAssetTimestamp=$lastModifiedAssetTimestamp]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@@ -97,6 +108,11 @@ class AlbumResponseDto {
json[r'sharedUsers'] = this.sharedUsers;
json[r'assets'] = this.assets;
json[r'owner'] = this.owner;
if (this.lastModifiedAssetTimestamp != null) {
json[r'lastModifiedAssetTimestamp'] = this.lastModifiedAssetTimestamp!.toUtc().toIso8601String();
} else {
// json[r'lastModifiedAssetTimestamp'] = null;
}
return json;
}
@@ -130,6 +146,7 @@ class AlbumResponseDto {
sharedUsers: UserResponseDto.listFromJson(json[r'sharedUsers']),
assets: AssetResponseDto.listFromJson(json[r'assets']),
owner: UserResponseDto.fromJson(json[r'owner'])!,
lastModifiedAssetTimestamp: mapDateTime(json, r'lastModifiedAssetTimestamp', ''),
);
}
return null;

View File

@@ -71,6 +71,11 @@ void main() {
// TODO
});
// DateTime lastModifiedAssetTimestamp
test('to test the property `lastModifiedAssetTimestamp`', () async {
// TODO
});
});