mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
chore(server): Improve add to multiple albums via bulk checks and inserts (#21052)
* - add addAssetIdsToAlbums to album repo - update albumService to determine all albums and assets with access and coalesce into one set of album_assets to insert * - remove hasAsset check (unnecessary) * - lint * - cleanup * - remove success counts from addAssetsToAlbums results - Fix tests * open-api * await album update
This commit is contained in:
parent
28dce2d0df
commit
3f1e11afcc
7 changed files with 117 additions and 110 deletions
|
|
@ -13,16 +13,10 @@ part of openapi.api;
|
|||
class AlbumsAddAssetsResponseDto {
|
||||
/// Returns a new [AlbumsAddAssetsResponseDto] instance.
|
||||
AlbumsAddAssetsResponseDto({
|
||||
required this.albumSuccessCount,
|
||||
required this.assetSuccessCount,
|
||||
this.error,
|
||||
required this.success,
|
||||
});
|
||||
|
||||
int albumSuccessCount;
|
||||
|
||||
int assetSuccessCount;
|
||||
|
||||
///
|
||||
/// 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
|
||||
|
|
@ -35,26 +29,20 @@ class AlbumsAddAssetsResponseDto {
|
|||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is AlbumsAddAssetsResponseDto &&
|
||||
other.albumSuccessCount == albumSuccessCount &&
|
||||
other.assetSuccessCount == assetSuccessCount &&
|
||||
other.error == error &&
|
||||
other.success == success;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(albumSuccessCount.hashCode) +
|
||||
(assetSuccessCount.hashCode) +
|
||||
(error == null ? 0 : error!.hashCode) +
|
||||
(success.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'AlbumsAddAssetsResponseDto[albumSuccessCount=$albumSuccessCount, assetSuccessCount=$assetSuccessCount, error=$error, success=$success]';
|
||||
String toString() => 'AlbumsAddAssetsResponseDto[error=$error, success=$success]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'albumSuccessCount'] = this.albumSuccessCount;
|
||||
json[r'assetSuccessCount'] = this.assetSuccessCount;
|
||||
if (this.error != null) {
|
||||
json[r'error'] = this.error;
|
||||
} else {
|
||||
|
|
@ -73,8 +61,6 @@ class AlbumsAddAssetsResponseDto {
|
|||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return AlbumsAddAssetsResponseDto(
|
||||
albumSuccessCount: mapValueOfType<int>(json, r'albumSuccessCount')!,
|
||||
assetSuccessCount: mapValueOfType<int>(json, r'assetSuccessCount')!,
|
||||
error: BulkIdErrorReason.fromJson(json[r'error']),
|
||||
success: mapValueOfType<bool>(json, r'success')!,
|
||||
);
|
||||
|
|
@ -124,8 +110,6 @@ class AlbumsAddAssetsResponseDto {
|
|||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'albumSuccessCount',
|
||||
'assetSuccessCount',
|
||||
'success',
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue