mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
refactor(server)!: add/remove album assets (#3109)
* refactor: add/remove album assets * chore: open api * feat: remove owned assets from album * refactor: move to bulk id req/res dto * chore: open api * chore: merge main * dev: mobile work * fix: adding asset from web not sync with mobile * remove print statement --------- Co-authored-by: Alex Tran <Alex.Tran@conductix.com>
This commit is contained in:
parent
ba71c83948
commit
b9cda59172
51 changed files with 890 additions and 1282 deletions
125
mobile/openapi/lib/model/add_assets_response_dto.dart
generated
125
mobile/openapi/lib/model/add_assets_response_dto.dart
generated
|
|
@ -1,125 +0,0 @@
|
|||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// 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 AddAssetsResponseDto {
|
||||
/// Returns a new [AddAssetsResponseDto] instance.
|
||||
AddAssetsResponseDto({
|
||||
this.album,
|
||||
this.alreadyInAlbum = const [],
|
||||
required this.successfullyAdded,
|
||||
});
|
||||
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
AlbumResponseDto? album;
|
||||
|
||||
List<String> alreadyInAlbum;
|
||||
|
||||
int successfullyAdded;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is AddAssetsResponseDto &&
|
||||
other.album == album &&
|
||||
other.alreadyInAlbum == alreadyInAlbum &&
|
||||
other.successfullyAdded == successfullyAdded;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(album == null ? 0 : album!.hashCode) +
|
||||
(alreadyInAlbum.hashCode) +
|
||||
(successfullyAdded.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'AddAssetsResponseDto[album=$album, alreadyInAlbum=$alreadyInAlbum, successfullyAdded=$successfullyAdded]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (this.album != null) {
|
||||
json[r'album'] = this.album;
|
||||
} else {
|
||||
// json[r'album'] = null;
|
||||
}
|
||||
json[r'alreadyInAlbum'] = this.alreadyInAlbum;
|
||||
json[r'successfullyAdded'] = this.successfullyAdded;
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [AddAssetsResponseDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static AddAssetsResponseDto? fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return AddAssetsResponseDto(
|
||||
album: AlbumResponseDto.fromJson(json[r'album']),
|
||||
alreadyInAlbum: json[r'alreadyInAlbum'] is Iterable
|
||||
? (json[r'alreadyInAlbum'] as Iterable).cast<String>().toList(growable: false)
|
||||
: const [],
|
||||
successfullyAdded: mapValueOfType<int>(json, r'successfullyAdded')!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<AddAssetsResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <AddAssetsResponseDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = AddAssetsResponseDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, AddAssetsResponseDto> mapFromJson(dynamic json) {
|
||||
final map = <String, AddAssetsResponseDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = AddAssetsResponseDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of AddAssetsResponseDto-objects as value to a dart map
|
||||
static Map<String, List<AddAssetsResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<AddAssetsResponseDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = AddAssetsResponseDto.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'alreadyInAlbum',
|
||||
'successfullyAdded',
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -10,53 +10,53 @@
|
|||
|
||||
part of openapi.api;
|
||||
|
||||
class AddAssetsDto {
|
||||
/// Returns a new [AddAssetsDto] instance.
|
||||
AddAssetsDto({
|
||||
this.assetIds = const [],
|
||||
class BulkIdsDto {
|
||||
/// Returns a new [BulkIdsDto] instance.
|
||||
BulkIdsDto({
|
||||
this.ids = const [],
|
||||
});
|
||||
|
||||
List<String> assetIds;
|
||||
List<String> ids;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is AddAssetsDto &&
|
||||
other.assetIds == assetIds;
|
||||
bool operator ==(Object other) => identical(this, other) || other is BulkIdsDto &&
|
||||
other.ids == ids;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(assetIds.hashCode);
|
||||
(ids.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'AddAssetsDto[assetIds=$assetIds]';
|
||||
String toString() => 'BulkIdsDto[ids=$ids]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'assetIds'] = this.assetIds;
|
||||
json[r'ids'] = this.ids;
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [AddAssetsDto] instance and imports its values from
|
||||
/// Returns a new [BulkIdsDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static AddAssetsDto? fromJson(dynamic value) {
|
||||
static BulkIdsDto? fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return AddAssetsDto(
|
||||
assetIds: json[r'assetIds'] is Iterable
|
||||
? (json[r'assetIds'] as Iterable).cast<String>().toList(growable: false)
|
||||
return BulkIdsDto(
|
||||
ids: json[r'ids'] is Iterable
|
||||
? (json[r'ids'] as Iterable).cast<String>().toList(growable: false)
|
||||
: const [],
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<AddAssetsDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <AddAssetsDto>[];
|
||||
static List<BulkIdsDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <BulkIdsDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = AddAssetsDto.fromJson(row);
|
||||
final value = BulkIdsDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
|
|
@ -65,12 +65,12 @@ class AddAssetsDto {
|
|||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, AddAssetsDto> mapFromJson(dynamic json) {
|
||||
final map = <String, AddAssetsDto>{};
|
||||
static Map<String, BulkIdsDto> mapFromJson(dynamic json) {
|
||||
final map = <String, BulkIdsDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = AddAssetsDto.fromJson(entry.value);
|
||||
final value = BulkIdsDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
|
|
@ -79,14 +79,14 @@ class AddAssetsDto {
|
|||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of AddAssetsDto-objects as value to a dart map
|
||||
static Map<String, List<AddAssetsDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<AddAssetsDto>>{};
|
||||
// maps a json object with a list of BulkIdsDto-objects as value to a dart map
|
||||
static Map<String, List<BulkIdsDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<BulkIdsDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = AddAssetsDto.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = BulkIdsDto.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
|
|
@ -94,7 +94,7 @@ class AddAssetsDto {
|
|||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'assetIds',
|
||||
'ids',
|
||||
};
|
||||
}
|
||||
|
||||
100
mobile/openapi/lib/model/remove_assets_dto.dart
generated
100
mobile/openapi/lib/model/remove_assets_dto.dart
generated
|
|
@ -1,100 +0,0 @@
|
|||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// 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 RemoveAssetsDto {
|
||||
/// Returns a new [RemoveAssetsDto] instance.
|
||||
RemoveAssetsDto({
|
||||
this.assetIds = const [],
|
||||
});
|
||||
|
||||
List<String> assetIds;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is RemoveAssetsDto &&
|
||||
other.assetIds == assetIds;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(assetIds.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'RemoveAssetsDto[assetIds=$assetIds]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'assetIds'] = this.assetIds;
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [RemoveAssetsDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static RemoveAssetsDto? fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return RemoveAssetsDto(
|
||||
assetIds: json[r'assetIds'] is Iterable
|
||||
? (json[r'assetIds'] as Iterable).cast<String>().toList(growable: false)
|
||||
: const [],
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<RemoveAssetsDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <RemoveAssetsDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = RemoveAssetsDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, RemoveAssetsDto> mapFromJson(dynamic json) {
|
||||
final map = <String, RemoveAssetsDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = RemoveAssetsDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of RemoveAssetsDto-objects as value to a dart map
|
||||
static Map<String, List<RemoveAssetsDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<RemoveAssetsDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = RemoveAssetsDto.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'assetIds',
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue