mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat(server/web): album description (#3558)
* feat(server): add album description * chore: open api * fix: tests * show and edit description on the web * fix test * remove unused code * type event * format fix --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
parent
deaf81e2a4
commit
2f26a7edae
28 changed files with 287 additions and 41 deletions
10
mobile/openapi/lib/model/album_response_dto.dart
generated
10
mobile/openapi/lib/model/album_response_dto.dart
generated
|
|
@ -18,6 +18,7 @@ class AlbumResponseDto {
|
|||
required this.assetCount,
|
||||
this.assets = const [],
|
||||
required this.createdAt,
|
||||
required this.description,
|
||||
required this.id,
|
||||
this.lastModifiedAssetTimestamp,
|
||||
required this.owner,
|
||||
|
|
@ -37,6 +38,8 @@ class AlbumResponseDto {
|
|||
|
||||
DateTime createdAt;
|
||||
|
||||
String description;
|
||||
|
||||
String id;
|
||||
|
||||
///
|
||||
|
|
@ -64,6 +67,7 @@ class AlbumResponseDto {
|
|||
other.assetCount == assetCount &&
|
||||
other.assets == assets &&
|
||||
other.createdAt == createdAt &&
|
||||
other.description == description &&
|
||||
other.id == id &&
|
||||
other.lastModifiedAssetTimestamp == lastModifiedAssetTimestamp &&
|
||||
other.owner == owner &&
|
||||
|
|
@ -80,6 +84,7 @@ class AlbumResponseDto {
|
|||
(assetCount.hashCode) +
|
||||
(assets.hashCode) +
|
||||
(createdAt.hashCode) +
|
||||
(description.hashCode) +
|
||||
(id.hashCode) +
|
||||
(lastModifiedAssetTimestamp == null ? 0 : lastModifiedAssetTimestamp!.hashCode) +
|
||||
(owner.hashCode) +
|
||||
|
|
@ -89,7 +94,7 @@ class AlbumResponseDto {
|
|||
(updatedAt.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'AlbumResponseDto[albumName=$albumName, albumThumbnailAssetId=$albumThumbnailAssetId, assetCount=$assetCount, assets=$assets, createdAt=$createdAt, id=$id, lastModifiedAssetTimestamp=$lastModifiedAssetTimestamp, owner=$owner, ownerId=$ownerId, shared=$shared, sharedUsers=$sharedUsers, updatedAt=$updatedAt]';
|
||||
String toString() => 'AlbumResponseDto[albumName=$albumName, albumThumbnailAssetId=$albumThumbnailAssetId, assetCount=$assetCount, assets=$assets, createdAt=$createdAt, description=$description, id=$id, lastModifiedAssetTimestamp=$lastModifiedAssetTimestamp, owner=$owner, ownerId=$ownerId, shared=$shared, sharedUsers=$sharedUsers, updatedAt=$updatedAt]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
|
|
@ -102,6 +107,7 @@ class AlbumResponseDto {
|
|||
json[r'assetCount'] = this.assetCount;
|
||||
json[r'assets'] = this.assets;
|
||||
json[r'createdAt'] = this.createdAt.toUtc().toIso8601String();
|
||||
json[r'description'] = this.description;
|
||||
json[r'id'] = this.id;
|
||||
if (this.lastModifiedAssetTimestamp != null) {
|
||||
json[r'lastModifiedAssetTimestamp'] = this.lastModifiedAssetTimestamp!.toUtc().toIso8601String();
|
||||
|
|
@ -129,6 +135,7 @@ class AlbumResponseDto {
|
|||
assetCount: mapValueOfType<int>(json, r'assetCount')!,
|
||||
assets: AssetResponseDto.listFromJson(json[r'assets']),
|
||||
createdAt: mapDateTime(json, r'createdAt', r'')!,
|
||||
description: mapValueOfType<String>(json, r'description')!,
|
||||
id: mapValueOfType<String>(json, r'id')!,
|
||||
lastModifiedAssetTimestamp: mapDateTime(json, r'lastModifiedAssetTimestamp', r''),
|
||||
owner: UserResponseDto.fromJson(json[r'owner'])!,
|
||||
|
|
@ -188,6 +195,7 @@ class AlbumResponseDto {
|
|||
'assetCount',
|
||||
'assets',
|
||||
'createdAt',
|
||||
'description',
|
||||
'id',
|
||||
'owner',
|
||||
'ownerId',
|
||||
|
|
|
|||
19
mobile/openapi/lib/model/create_album_dto.dart
generated
19
mobile/openapi/lib/model/create_album_dto.dart
generated
|
|
@ -15,6 +15,7 @@ class CreateAlbumDto {
|
|||
CreateAlbumDto({
|
||||
required this.albumName,
|
||||
this.assetIds = const [],
|
||||
this.description,
|
||||
this.sharedWithUserIds = const [],
|
||||
});
|
||||
|
||||
|
|
@ -22,12 +23,21 @@ class CreateAlbumDto {
|
|||
|
||||
List<String> assetIds;
|
||||
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
String? description;
|
||||
|
||||
List<String> sharedWithUserIds;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is CreateAlbumDto &&
|
||||
other.albumName == albumName &&
|
||||
other.assetIds == assetIds &&
|
||||
other.description == description &&
|
||||
other.sharedWithUserIds == sharedWithUserIds;
|
||||
|
||||
@override
|
||||
|
|
@ -35,15 +45,21 @@ class CreateAlbumDto {
|
|||
// ignore: unnecessary_parenthesis
|
||||
(albumName.hashCode) +
|
||||
(assetIds.hashCode) +
|
||||
(description == null ? 0 : description!.hashCode) +
|
||||
(sharedWithUserIds.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'CreateAlbumDto[albumName=$albumName, assetIds=$assetIds, sharedWithUserIds=$sharedWithUserIds]';
|
||||
String toString() => 'CreateAlbumDto[albumName=$albumName, assetIds=$assetIds, description=$description, sharedWithUserIds=$sharedWithUserIds]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'albumName'] = this.albumName;
|
||||
json[r'assetIds'] = this.assetIds;
|
||||
if (this.description != null) {
|
||||
json[r'description'] = this.description;
|
||||
} else {
|
||||
// json[r'description'] = null;
|
||||
}
|
||||
json[r'sharedWithUserIds'] = this.sharedWithUserIds;
|
||||
return json;
|
||||
}
|
||||
|
|
@ -60,6 +76,7 @@ class CreateAlbumDto {
|
|||
assetIds: json[r'assetIds'] is Iterable
|
||||
? (json[r'assetIds'] as Iterable).cast<String>().toList(growable: false)
|
||||
: const [],
|
||||
description: mapValueOfType<String>(json, r'description'),
|
||||
sharedWithUserIds: json[r'sharedWithUserIds'] is Iterable
|
||||
? (json[r'sharedWithUserIds'] as Iterable).cast<String>().toList(growable: false)
|
||||
: const [],
|
||||
|
|
|
|||
23
mobile/openapi/lib/model/update_album_dto.dart
generated
23
mobile/openapi/lib/model/update_album_dto.dart
generated
|
|
@ -15,6 +15,7 @@ class UpdateAlbumDto {
|
|||
UpdateAlbumDto({
|
||||
this.albumName,
|
||||
this.albumThumbnailAssetId,
|
||||
this.description,
|
||||
});
|
||||
|
||||
///
|
||||
|
|
@ -33,19 +34,29 @@ class UpdateAlbumDto {
|
|||
///
|
||||
String? albumThumbnailAssetId;
|
||||
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
String? description;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is UpdateAlbumDto &&
|
||||
other.albumName == albumName &&
|
||||
other.albumThumbnailAssetId == albumThumbnailAssetId;
|
||||
other.albumThumbnailAssetId == albumThumbnailAssetId &&
|
||||
other.description == description;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(albumName == null ? 0 : albumName!.hashCode) +
|
||||
(albumThumbnailAssetId == null ? 0 : albumThumbnailAssetId!.hashCode);
|
||||
(albumThumbnailAssetId == null ? 0 : albumThumbnailAssetId!.hashCode) +
|
||||
(description == null ? 0 : description!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'UpdateAlbumDto[albumName=$albumName, albumThumbnailAssetId=$albumThumbnailAssetId]';
|
||||
String toString() => 'UpdateAlbumDto[albumName=$albumName, albumThumbnailAssetId=$albumThumbnailAssetId, description=$description]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
|
|
@ -59,6 +70,11 @@ class UpdateAlbumDto {
|
|||
} else {
|
||||
// json[r'albumThumbnailAssetId'] = null;
|
||||
}
|
||||
if (this.description != null) {
|
||||
json[r'description'] = this.description;
|
||||
} else {
|
||||
// json[r'description'] = null;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
|
|
@ -72,6 +88,7 @@ class UpdateAlbumDto {
|
|||
return UpdateAlbumDto(
|
||||
albumName: mapValueOfType<String>(json, r'albumName'),
|
||||
albumThumbnailAssetId: mapValueOfType<String>(json, r'albumThumbnailAssetId'),
|
||||
description: mapValueOfType<String>(json, r'description'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue