mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat(server): trash asset (#4015)
* refactor(server): delete assets endpoint * fix: formatting * chore: cleanup * chore: open api * chore(mobile): replace DeleteAssetDTO with BulkIdsDTOs * feat: trash an asset * chore(server): formatting * chore: open api * chore: wording * chore: open-api * feat(server): add withDeleted to getAssets queries * WIP: mobile-recycle-bin * feat(server): recycle-bin to system config * feat(web): use recycle-bin system config * chore(server): domain assetcore removed * chore(server): rename recycle-bin to trash * chore(web): rename recycle-bin to trash * chore(server): always send soft deleted assets for getAllByUserId * chore(web): formatting * feat(server): permanent delete assets older than trashed period * feat(web): trash empty placeholder image * feat(server): empty trash * feat(web): empty trash * WIP: mobile-recycle-bin * refactor(server): empty / restore trash to separate endpoint * test(server): handle failures * test(server): fix e2e server-info test * test(server): deletion test refactor * feat(mobile): use map settings from server-config to enable / disable map * feat(mobile): trash asset * fix(server): operations on assets in trash * feat(web): show trash statistics * fix(web): handle trash enabled * fix(mobile): restore updates from trash * fix(server): ignore trashed assets for person * fix(server): add / remove search index when trashed / restored * chore(web): format * fix(server): asset service test * fix(server): include trashed assts for duplicates from uploads * feat(mobile): no dialog for trash, always dialog for permanent delete * refactor(mobile): use isar where instead of dart filter * refactor(mobile): asset provide - handle deletes in single db txn * chore(mobile): review changes * feat(web): confirmation before empty trash * server: review changes * fix(server): handle library changes * fix: filter external assets from getting trashed / deleted * fix(server): empty-bin * feat: broadcast config update events through ws * change order of trash button on mobile * styling * fix(mobile): do not show trashed toast for local only assets --------- Co-authored-by: Jason Rasmussen <jrasm91@gmail.com> Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
parent
fc93762230
commit
4a8887f37b
117 changed files with 3155 additions and 928 deletions
|
|
@ -10,40 +10,57 @@
|
|||
|
||||
part of openapi.api;
|
||||
|
||||
class DeleteAssetDto {
|
||||
/// Returns a new [DeleteAssetDto] instance.
|
||||
DeleteAssetDto({
|
||||
class AssetBulkDeleteDto {
|
||||
/// Returns a new [AssetBulkDeleteDto] instance.
|
||||
AssetBulkDeleteDto({
|
||||
this.force,
|
||||
this.ids = const [],
|
||||
});
|
||||
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
bool? force;
|
||||
|
||||
List<String> ids;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is DeleteAssetDto &&
|
||||
bool operator ==(Object other) => identical(this, other) || other is AssetBulkDeleteDto &&
|
||||
other.force == force &&
|
||||
other.ids == ids;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(force == null ? 0 : force!.hashCode) +
|
||||
(ids.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'DeleteAssetDto[ids=$ids]';
|
||||
String toString() => 'AssetBulkDeleteDto[force=$force, ids=$ids]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (this.force != null) {
|
||||
json[r'force'] = this.force;
|
||||
} else {
|
||||
// json[r'force'] = null;
|
||||
}
|
||||
json[r'ids'] = this.ids;
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [DeleteAssetDto] instance and imports its values from
|
||||
/// Returns a new [AssetBulkDeleteDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static DeleteAssetDto? fromJson(dynamic value) {
|
||||
static AssetBulkDeleteDto? fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return DeleteAssetDto(
|
||||
return AssetBulkDeleteDto(
|
||||
force: mapValueOfType<bool>(json, r'force'),
|
||||
ids: json[r'ids'] is List
|
||||
? (json[r'ids'] as List).cast<String>()
|
||||
: const [],
|
||||
|
|
@ -52,11 +69,11 @@ class DeleteAssetDto {
|
|||
return null;
|
||||
}
|
||||
|
||||
static List<DeleteAssetDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <DeleteAssetDto>[];
|
||||
static List<AssetBulkDeleteDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <AssetBulkDeleteDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = DeleteAssetDto.fromJson(row);
|
||||
final value = AssetBulkDeleteDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
|
|
@ -65,12 +82,12 @@ class DeleteAssetDto {
|
|||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, DeleteAssetDto> mapFromJson(dynamic json) {
|
||||
final map = <String, DeleteAssetDto>{};
|
||||
static Map<String, AssetBulkDeleteDto> mapFromJson(dynamic json) {
|
||||
final map = <String, AssetBulkDeleteDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = DeleteAssetDto.fromJson(entry.value);
|
||||
final value = AssetBulkDeleteDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
|
|
@ -79,14 +96,14 @@ class DeleteAssetDto {
|
|||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of DeleteAssetDto-objects as value to a dart map
|
||||
static Map<String, List<DeleteAssetDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<DeleteAssetDto>>{};
|
||||
// maps a json object with a list of AssetBulkDeleteDto-objects as value to a dart map
|
||||
static Map<String, List<AssetBulkDeleteDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<AssetBulkDeleteDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = DeleteAssetDto.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = AssetBulkDeleteDto.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
10
mobile/openapi/lib/model/asset_response_dto.dart
generated
10
mobile/openapi/lib/model/asset_response_dto.dart
generated
|
|
@ -26,6 +26,7 @@ class AssetResponseDto {
|
|||
required this.isFavorite,
|
||||
required this.isOffline,
|
||||
required this.isReadOnly,
|
||||
required this.isTrashed,
|
||||
required this.libraryId,
|
||||
this.livePhotoVideoId,
|
||||
required this.localDateTime,
|
||||
|
|
@ -75,6 +76,8 @@ class AssetResponseDto {
|
|||
|
||||
bool isReadOnly;
|
||||
|
||||
bool isTrashed;
|
||||
|
||||
String libraryId;
|
||||
|
||||
String? livePhotoVideoId;
|
||||
|
|
@ -131,6 +134,7 @@ class AssetResponseDto {
|
|||
other.isFavorite == isFavorite &&
|
||||
other.isOffline == isOffline &&
|
||||
other.isReadOnly == isReadOnly &&
|
||||
other.isTrashed == isTrashed &&
|
||||
other.libraryId == libraryId &&
|
||||
other.livePhotoVideoId == livePhotoVideoId &&
|
||||
other.localDateTime == localDateTime &&
|
||||
|
|
@ -162,6 +166,7 @@ class AssetResponseDto {
|
|||
(isFavorite.hashCode) +
|
||||
(isOffline.hashCode) +
|
||||
(isReadOnly.hashCode) +
|
||||
(isTrashed.hashCode) +
|
||||
(libraryId.hashCode) +
|
||||
(livePhotoVideoId == null ? 0 : livePhotoVideoId!.hashCode) +
|
||||
(localDateTime.hashCode) +
|
||||
|
|
@ -178,7 +183,7 @@ class AssetResponseDto {
|
|||
(updatedAt.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'AssetResponseDto[checksum=$checksum, deviceAssetId=$deviceAssetId, deviceId=$deviceId, duration=$duration, exifInfo=$exifInfo, fileCreatedAt=$fileCreatedAt, fileModifiedAt=$fileModifiedAt, id=$id, isArchived=$isArchived, isExternal=$isExternal, isFavorite=$isFavorite, isOffline=$isOffline, isReadOnly=$isReadOnly, libraryId=$libraryId, livePhotoVideoId=$livePhotoVideoId, localDateTime=$localDateTime, originalFileName=$originalFileName, originalPath=$originalPath, owner=$owner, ownerId=$ownerId, people=$people, resized=$resized, smartInfo=$smartInfo, tags=$tags, thumbhash=$thumbhash, type=$type, updatedAt=$updatedAt]';
|
||||
String toString() => 'AssetResponseDto[checksum=$checksum, deviceAssetId=$deviceAssetId, deviceId=$deviceId, duration=$duration, exifInfo=$exifInfo, fileCreatedAt=$fileCreatedAt, fileModifiedAt=$fileModifiedAt, id=$id, isArchived=$isArchived, isExternal=$isExternal, isFavorite=$isFavorite, isOffline=$isOffline, isReadOnly=$isReadOnly, isTrashed=$isTrashed, libraryId=$libraryId, livePhotoVideoId=$livePhotoVideoId, localDateTime=$localDateTime, originalFileName=$originalFileName, originalPath=$originalPath, owner=$owner, ownerId=$ownerId, people=$people, resized=$resized, smartInfo=$smartInfo, tags=$tags, thumbhash=$thumbhash, type=$type, updatedAt=$updatedAt]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
|
|
@ -199,6 +204,7 @@ class AssetResponseDto {
|
|||
json[r'isFavorite'] = this.isFavorite;
|
||||
json[r'isOffline'] = this.isOffline;
|
||||
json[r'isReadOnly'] = this.isReadOnly;
|
||||
json[r'isTrashed'] = this.isTrashed;
|
||||
json[r'libraryId'] = this.libraryId;
|
||||
if (this.livePhotoVideoId != null) {
|
||||
json[r'livePhotoVideoId'] = this.livePhotoVideoId;
|
||||
|
|
@ -253,6 +259,7 @@ class AssetResponseDto {
|
|||
isFavorite: mapValueOfType<bool>(json, r'isFavorite')!,
|
||||
isOffline: mapValueOfType<bool>(json, r'isOffline')!,
|
||||
isReadOnly: mapValueOfType<bool>(json, r'isReadOnly')!,
|
||||
isTrashed: mapValueOfType<bool>(json, r'isTrashed')!,
|
||||
libraryId: mapValueOfType<String>(json, r'libraryId')!,
|
||||
livePhotoVideoId: mapValueOfType<String>(json, r'livePhotoVideoId'),
|
||||
localDateTime: mapDateTime(json, r'localDateTime', '')!,
|
||||
|
|
@ -326,6 +333,7 @@ class AssetResponseDto {
|
|||
'isFavorite',
|
||||
'isOffline',
|
||||
'isReadOnly',
|
||||
'isTrashed',
|
||||
'libraryId',
|
||||
'localDateTime',
|
||||
'originalFileName',
|
||||
|
|
|
|||
85
mobile/openapi/lib/model/delete_asset_status.dart
generated
85
mobile/openapi/lib/model/delete_asset_status.dart
generated
|
|
@ -1,85 +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 DeleteAssetStatus {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const DeleteAssetStatus._(this.value);
|
||||
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
String toJson() => value;
|
||||
|
||||
static const SUCCESS = DeleteAssetStatus._(r'SUCCESS');
|
||||
static const FAILED = DeleteAssetStatus._(r'FAILED');
|
||||
|
||||
/// List of all possible values in this [enum][DeleteAssetStatus].
|
||||
static const values = <DeleteAssetStatus>[
|
||||
SUCCESS,
|
||||
FAILED,
|
||||
];
|
||||
|
||||
static DeleteAssetStatus? fromJson(dynamic value) => DeleteAssetStatusTypeTransformer().decode(value);
|
||||
|
||||
static List<DeleteAssetStatus>? listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <DeleteAssetStatus>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = DeleteAssetStatus.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [DeleteAssetStatus] to String,
|
||||
/// and [decode] dynamic data back to [DeleteAssetStatus].
|
||||
class DeleteAssetStatusTypeTransformer {
|
||||
factory DeleteAssetStatusTypeTransformer() => _instance ??= const DeleteAssetStatusTypeTransformer._();
|
||||
|
||||
const DeleteAssetStatusTypeTransformer._();
|
||||
|
||||
String encode(DeleteAssetStatus data) => data.value;
|
||||
|
||||
/// Decodes a [dynamic value][data] to a DeleteAssetStatus.
|
||||
///
|
||||
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
|
||||
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
|
||||
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
|
||||
///
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
DeleteAssetStatus? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case r'SUCCESS': return DeleteAssetStatus.SUCCESS;
|
||||
case r'FAILED': return DeleteAssetStatus.FAILED;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Singleton [DeleteAssetStatusTypeTransformer] instance.
|
||||
static DeleteAssetStatusTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
14
mobile/openapi/lib/model/server_config_dto.dart
generated
14
mobile/openapi/lib/model/server_config_dto.dart
generated
|
|
@ -16,6 +16,7 @@ class ServerConfigDto {
|
|||
required this.loginPageMessage,
|
||||
required this.mapTileUrl,
|
||||
required this.oauthButtonText,
|
||||
required this.trashDays,
|
||||
});
|
||||
|
||||
String loginPageMessage;
|
||||
|
|
@ -24,27 +25,32 @@ class ServerConfigDto {
|
|||
|
||||
String oauthButtonText;
|
||||
|
||||
int trashDays;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is ServerConfigDto &&
|
||||
other.loginPageMessage == loginPageMessage &&
|
||||
other.mapTileUrl == mapTileUrl &&
|
||||
other.oauthButtonText == oauthButtonText;
|
||||
other.oauthButtonText == oauthButtonText &&
|
||||
other.trashDays == trashDays;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(loginPageMessage.hashCode) +
|
||||
(mapTileUrl.hashCode) +
|
||||
(oauthButtonText.hashCode);
|
||||
(oauthButtonText.hashCode) +
|
||||
(trashDays.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'ServerConfigDto[loginPageMessage=$loginPageMessage, mapTileUrl=$mapTileUrl, oauthButtonText=$oauthButtonText]';
|
||||
String toString() => 'ServerConfigDto[loginPageMessage=$loginPageMessage, mapTileUrl=$mapTileUrl, oauthButtonText=$oauthButtonText, trashDays=$trashDays]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'loginPageMessage'] = this.loginPageMessage;
|
||||
json[r'mapTileUrl'] = this.mapTileUrl;
|
||||
json[r'oauthButtonText'] = this.oauthButtonText;
|
||||
json[r'trashDays'] = this.trashDays;
|
||||
return json;
|
||||
}
|
||||
|
||||
|
|
@ -59,6 +65,7 @@ class ServerConfigDto {
|
|||
loginPageMessage: mapValueOfType<String>(json, r'loginPageMessage')!,
|
||||
mapTileUrl: mapValueOfType<String>(json, r'mapTileUrl')!,
|
||||
oauthButtonText: mapValueOfType<String>(json, r'oauthButtonText')!,
|
||||
trashDays: mapValueOfType<int>(json, r'trashDays')!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
|
|
@ -109,6 +116,7 @@ class ServerConfigDto {
|
|||
'loginPageMessage',
|
||||
'mapTileUrl',
|
||||
'oauthButtonText',
|
||||
'trashDays',
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
14
mobile/openapi/lib/model/server_features_dto.dart
generated
14
mobile/openapi/lib/model/server_features_dto.dart
generated
|
|
@ -24,6 +24,7 @@ class ServerFeaturesDto {
|
|||
required this.search,
|
||||
required this.sidecar,
|
||||
required this.tagImage,
|
||||
required this.trash,
|
||||
});
|
||||
|
||||
bool clipEncode;
|
||||
|
|
@ -48,6 +49,8 @@ class ServerFeaturesDto {
|
|||
|
||||
bool tagImage;
|
||||
|
||||
bool trash;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is ServerFeaturesDto &&
|
||||
other.clipEncode == clipEncode &&
|
||||
|
|
@ -60,7 +63,8 @@ class ServerFeaturesDto {
|
|||
other.reverseGeocoding == reverseGeocoding &&
|
||||
other.search == search &&
|
||||
other.sidecar == sidecar &&
|
||||
other.tagImage == tagImage;
|
||||
other.tagImage == tagImage &&
|
||||
other.trash == trash;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
|
|
@ -75,10 +79,11 @@ class ServerFeaturesDto {
|
|||
(reverseGeocoding.hashCode) +
|
||||
(search.hashCode) +
|
||||
(sidecar.hashCode) +
|
||||
(tagImage.hashCode);
|
||||
(tagImage.hashCode) +
|
||||
(trash.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'ServerFeaturesDto[clipEncode=$clipEncode, configFile=$configFile, facialRecognition=$facialRecognition, map=$map, oauth=$oauth, oauthAutoLaunch=$oauthAutoLaunch, passwordLogin=$passwordLogin, reverseGeocoding=$reverseGeocoding, search=$search, sidecar=$sidecar, tagImage=$tagImage]';
|
||||
String toString() => 'ServerFeaturesDto[clipEncode=$clipEncode, configFile=$configFile, facialRecognition=$facialRecognition, map=$map, oauth=$oauth, oauthAutoLaunch=$oauthAutoLaunch, passwordLogin=$passwordLogin, reverseGeocoding=$reverseGeocoding, search=$search, sidecar=$sidecar, tagImage=$tagImage, trash=$trash]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
|
|
@ -93,6 +98,7 @@ class ServerFeaturesDto {
|
|||
json[r'search'] = this.search;
|
||||
json[r'sidecar'] = this.sidecar;
|
||||
json[r'tagImage'] = this.tagImage;
|
||||
json[r'trash'] = this.trash;
|
||||
return json;
|
||||
}
|
||||
|
||||
|
|
@ -115,6 +121,7 @@ class ServerFeaturesDto {
|
|||
search: mapValueOfType<bool>(json, r'search')!,
|
||||
sidecar: mapValueOfType<bool>(json, r'sidecar')!,
|
||||
tagImage: mapValueOfType<bool>(json, r'tagImage')!,
|
||||
trash: mapValueOfType<bool>(json, r'trash')!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
|
|
@ -173,6 +180,7 @@ class ServerFeaturesDto {
|
|||
'search',
|
||||
'sidecar',
|
||||
'tagImage',
|
||||
'trash',
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
14
mobile/openapi/lib/model/system_config_dto.dart
generated
14
mobile/openapi/lib/model/system_config_dto.dart
generated
|
|
@ -22,6 +22,7 @@ class SystemConfigDto {
|
|||
required this.reverseGeocoding,
|
||||
required this.storageTemplate,
|
||||
required this.thumbnail,
|
||||
required this.trash,
|
||||
});
|
||||
|
||||
SystemConfigFFmpegDto ffmpeg;
|
||||
|
|
@ -42,6 +43,8 @@ class SystemConfigDto {
|
|||
|
||||
SystemConfigThumbnailDto thumbnail;
|
||||
|
||||
SystemConfigTrashDto trash;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is SystemConfigDto &&
|
||||
other.ffmpeg == ffmpeg &&
|
||||
|
|
@ -52,7 +55,8 @@ class SystemConfigDto {
|
|||
other.passwordLogin == passwordLogin &&
|
||||
other.reverseGeocoding == reverseGeocoding &&
|
||||
other.storageTemplate == storageTemplate &&
|
||||
other.thumbnail == thumbnail;
|
||||
other.thumbnail == thumbnail &&
|
||||
other.trash == trash;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
|
|
@ -65,10 +69,11 @@ class SystemConfigDto {
|
|||
(passwordLogin.hashCode) +
|
||||
(reverseGeocoding.hashCode) +
|
||||
(storageTemplate.hashCode) +
|
||||
(thumbnail.hashCode);
|
||||
(thumbnail.hashCode) +
|
||||
(trash.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'SystemConfigDto[ffmpeg=$ffmpeg, job=$job, machineLearning=$machineLearning, map=$map, oauth=$oauth, passwordLogin=$passwordLogin, reverseGeocoding=$reverseGeocoding, storageTemplate=$storageTemplate, thumbnail=$thumbnail]';
|
||||
String toString() => 'SystemConfigDto[ffmpeg=$ffmpeg, job=$job, machineLearning=$machineLearning, map=$map, oauth=$oauth, passwordLogin=$passwordLogin, reverseGeocoding=$reverseGeocoding, storageTemplate=$storageTemplate, thumbnail=$thumbnail, trash=$trash]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
|
|
@ -81,6 +86,7 @@ class SystemConfigDto {
|
|||
json[r'reverseGeocoding'] = this.reverseGeocoding;
|
||||
json[r'storageTemplate'] = this.storageTemplate;
|
||||
json[r'thumbnail'] = this.thumbnail;
|
||||
json[r'trash'] = this.trash;
|
||||
return json;
|
||||
}
|
||||
|
||||
|
|
@ -101,6 +107,7 @@ class SystemConfigDto {
|
|||
reverseGeocoding: SystemConfigReverseGeocodingDto.fromJson(json[r'reverseGeocoding'])!,
|
||||
storageTemplate: SystemConfigStorageTemplateDto.fromJson(json[r'storageTemplate'])!,
|
||||
thumbnail: SystemConfigThumbnailDto.fromJson(json[r'thumbnail'])!,
|
||||
trash: SystemConfigTrashDto.fromJson(json[r'trash'])!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
|
|
@ -157,6 +164,7 @@ class SystemConfigDto {
|
|||
'reverseGeocoding',
|
||||
'storageTemplate',
|
||||
'thumbnail',
|
||||
'trash',
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,58 +10,58 @@
|
|||
|
||||
part of openapi.api;
|
||||
|
||||
class DeleteAssetResponseDto {
|
||||
/// Returns a new [DeleteAssetResponseDto] instance.
|
||||
DeleteAssetResponseDto({
|
||||
required this.id,
|
||||
required this.status,
|
||||
class SystemConfigTrashDto {
|
||||
/// Returns a new [SystemConfigTrashDto] instance.
|
||||
SystemConfigTrashDto({
|
||||
required this.days,
|
||||
required this.enabled,
|
||||
});
|
||||
|
||||
String id;
|
||||
int days;
|
||||
|
||||
DeleteAssetStatus status;
|
||||
bool enabled;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is DeleteAssetResponseDto &&
|
||||
other.id == id &&
|
||||
other.status == status;
|
||||
bool operator ==(Object other) => identical(this, other) || other is SystemConfigTrashDto &&
|
||||
other.days == days &&
|
||||
other.enabled == enabled;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(id.hashCode) +
|
||||
(status.hashCode);
|
||||
(days.hashCode) +
|
||||
(enabled.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'DeleteAssetResponseDto[id=$id, status=$status]';
|
||||
String toString() => 'SystemConfigTrashDto[days=$days, enabled=$enabled]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'id'] = this.id;
|
||||
json[r'status'] = this.status;
|
||||
json[r'days'] = this.days;
|
||||
json[r'enabled'] = this.enabled;
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [DeleteAssetResponseDto] instance and imports its values from
|
||||
/// Returns a new [SystemConfigTrashDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static DeleteAssetResponseDto? fromJson(dynamic value) {
|
||||
static SystemConfigTrashDto? fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return DeleteAssetResponseDto(
|
||||
id: mapValueOfType<String>(json, r'id')!,
|
||||
status: DeleteAssetStatus.fromJson(json[r'status'])!,
|
||||
return SystemConfigTrashDto(
|
||||
days: mapValueOfType<int>(json, r'days')!,
|
||||
enabled: mapValueOfType<bool>(json, r'enabled')!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<DeleteAssetResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <DeleteAssetResponseDto>[];
|
||||
static List<SystemConfigTrashDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <SystemConfigTrashDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = DeleteAssetResponseDto.fromJson(row);
|
||||
final value = SystemConfigTrashDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
|
|
@ -70,12 +70,12 @@ class DeleteAssetResponseDto {
|
|||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, DeleteAssetResponseDto> mapFromJson(dynamic json) {
|
||||
final map = <String, DeleteAssetResponseDto>{};
|
||||
static Map<String, SystemConfigTrashDto> mapFromJson(dynamic json) {
|
||||
final map = <String, SystemConfigTrashDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = DeleteAssetResponseDto.fromJson(entry.value);
|
||||
final value = SystemConfigTrashDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
|
|
@ -84,14 +84,14 @@ class DeleteAssetResponseDto {
|
|||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of DeleteAssetResponseDto-objects as value to a dart map
|
||||
static Map<String, List<DeleteAssetResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<DeleteAssetResponseDto>>{};
|
||||
// maps a json object with a list of SystemConfigTrashDto-objects as value to a dart map
|
||||
static Map<String, List<SystemConfigTrashDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<SystemConfigTrashDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = DeleteAssetResponseDto.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = SystemConfigTrashDto.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
|
|
@ -99,8 +99,8 @@ class DeleteAssetResponseDto {
|
|||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'id',
|
||||
'status',
|
||||
'days',
|
||||
'enabled',
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue