From efe060686399ae4ba59db67af09d9d04064215c1 Mon Sep 17 00:00:00 2001 From: izzy Date: Mon, 12 Jan 2026 14:05:37 +0000 Subject: [PATCH] fix: ensure `name` spec is defined correctly --- mobile/openapi/README.md | 6 ++ mobile/openapi/lib/api.dart | 6 ++ mobile/openapi/lib/api_client.dart | 12 +++ mobile/openapi/lib/api_helper.dart | 18 ++++ mobile/openapi/lib/model/database_backup.dart | 82 +++++++++++++++++++ .../lib/model/job_database_backup.dart | 4 +- .../openapi/lib/model/job_memory_cleanup.dart | 4 +- .../lib/model/job_memory_generate.dart | 4 +- .../openapi/lib/model/job_person_cleanup.dart | 4 +- mobile/openapi/lib/model/job_tag_cleanup.dart | 4 +- .../lib/model/job_user_delete_check.dart | 4 +- mobile/openapi/lib/model/memory_cleanup.dart | 82 +++++++++++++++++++ mobile/openapi/lib/model/memory_generate.dart | 82 +++++++++++++++++++ mobile/openapi/lib/model/person_cleanup.dart | 82 +++++++++++++++++++ .../lib/model/queue_job_create_dto_job.dart | 4 +- mobile/openapi/lib/model/tag_cleanup.dart | 82 +++++++++++++++++++ .../openapi/lib/model/user_delete_check.dart | 82 +++++++++++++++++++ open-api/immich-openapi-specs.json | 78 +++++++++++++++--- open-api/typescript-sdk/src/fetch-client.ts | 30 +++++-- server/src/dtos/queue.dto.ts | 6 ++ 20 files changed, 643 insertions(+), 33 deletions(-) create mode 100644 mobile/openapi/lib/model/database_backup.dart create mode 100644 mobile/openapi/lib/model/memory_cleanup.dart create mode 100644 mobile/openapi/lib/model/memory_generate.dart create mode 100644 mobile/openapi/lib/model/person_cleanup.dart create mode 100644 mobile/openapi/lib/model/tag_cleanup.dart create mode 100644 mobile/openapi/lib/model/user_delete_check.dart diff --git a/mobile/openapi/README.md b/mobile/openapi/README.md index f22a4e7395..6b1f67c761 100644 --- a/mobile/openapi/README.md +++ b/mobile/openapi/README.md @@ -406,6 +406,7 @@ Class | Method | HTTP request | Description - [CreateLibraryDto](doc//CreateLibraryDto.md) - [CreateProfileImageResponseDto](doc//CreateProfileImageResponseDto.md) - [CropParameters](doc//CropParameters.md) + - [DatabaseBackup](doc//DatabaseBackup.md) - [DatabaseBackupConfig](doc//DatabaseBackupConfig.md) - [DownloadArchiveInfo](doc//DownloadArchiveInfo.md) - [DownloadInfoDto](doc//DownloadInfoDto.md) @@ -448,7 +449,9 @@ Class | Method | HTTP request | Description - [MapReverseGeocodeResponseDto](doc//MapReverseGeocodeResponseDto.md) - [MemoriesResponse](doc//MemoriesResponse.md) - [MemoriesUpdate](doc//MemoriesUpdate.md) + - [MemoryCleanup](doc//MemoryCleanup.md) - [MemoryCreateDto](doc//MemoryCreateDto.md) + - [MemoryGenerate](doc//MemoryGenerate.md) - [MemoryResponseDto](doc//MemoryResponseDto.md) - [MemorySearchOrder](doc//MemorySearchOrder.md) - [MemoryStatisticsResponseDto](doc//MemoryStatisticsResponseDto.md) @@ -483,6 +486,7 @@ Class | Method | HTTP request | Description - [PeopleUpdateDto](doc//PeopleUpdateDto.md) - [PeopleUpdateItem](doc//PeopleUpdateItem.md) - [Permission](doc//Permission.md) + - [PersonCleanup](doc//PersonCleanup.md) - [PersonCreateDto](doc//PersonCreateDto.md) - [PersonResponseDto](doc//PersonResponseDto.md) - [PersonStatisticsResponseDto](doc//PersonStatisticsResponseDto.md) @@ -627,6 +631,7 @@ Class | Method | HTTP request | Description - [SystemConfigUserDto](doc//SystemConfigUserDto.md) - [TagBulkAssetsDto](doc//TagBulkAssetsDto.md) - [TagBulkAssetsResponseDto](doc//TagBulkAssetsResponseDto.md) + - [TagCleanup](doc//TagCleanup.md) - [TagCreateDto](doc//TagCreateDto.md) - [TagResponseDto](doc//TagResponseDto.md) - [TagUpdateDto](doc//TagUpdateDto.md) @@ -652,6 +657,7 @@ Class | Method | HTTP request | Description - [UserAdminResponseDto](doc//UserAdminResponseDto.md) - [UserAdminUpdateDto](doc//UserAdminUpdateDto.md) - [UserAvatarColor](doc//UserAvatarColor.md) + - [UserDeleteCheck](doc//UserDeleteCheck.md) - [UserLicense](doc//UserLicense.md) - [UserMetadataKey](doc//UserMetadataKey.md) - [UserPreferencesResponseDto](doc//UserPreferencesResponseDto.md) diff --git a/mobile/openapi/lib/api.dart b/mobile/openapi/lib/api.dart index 5ebcb64b11..caf2071608 100644 --- a/mobile/openapi/lib/api.dart +++ b/mobile/openapi/lib/api.dart @@ -151,6 +151,7 @@ part 'model/create_album_dto.dart'; part 'model/create_library_dto.dart'; part 'model/create_profile_image_response_dto.dart'; part 'model/crop_parameters.dart'; +part 'model/database_backup.dart'; part 'model/database_backup_config.dart'; part 'model/download_archive_info.dart'; part 'model/download_info_dto.dart'; @@ -193,7 +194,9 @@ part 'model/map_marker_response_dto.dart'; part 'model/map_reverse_geocode_response_dto.dart'; part 'model/memories_response.dart'; part 'model/memories_update.dart'; +part 'model/memory_cleanup.dart'; part 'model/memory_create_dto.dart'; +part 'model/memory_generate.dart'; part 'model/memory_response_dto.dart'; part 'model/memory_search_order.dart'; part 'model/memory_statistics_response_dto.dart'; @@ -228,6 +231,7 @@ part 'model/people_update.dart'; part 'model/people_update_dto.dart'; part 'model/people_update_item.dart'; part 'model/permission.dart'; +part 'model/person_cleanup.dart'; part 'model/person_create_dto.dart'; part 'model/person_response_dto.dart'; part 'model/person_statistics_response_dto.dart'; @@ -372,6 +376,7 @@ part 'model/system_config_trash_dto.dart'; part 'model/system_config_user_dto.dart'; part 'model/tag_bulk_assets_dto.dart'; part 'model/tag_bulk_assets_response_dto.dart'; +part 'model/tag_cleanup.dart'; part 'model/tag_create_dto.dart'; part 'model/tag_response_dto.dart'; part 'model/tag_update_dto.dart'; @@ -397,6 +402,7 @@ part 'model/user_admin_delete_dto.dart'; part 'model/user_admin_response_dto.dart'; part 'model/user_admin_update_dto.dart'; part 'model/user_avatar_color.dart'; +part 'model/user_delete_check.dart'; part 'model/user_license.dart'; part 'model/user_metadata_key.dart'; part 'model/user_preferences_response_dto.dart'; diff --git a/mobile/openapi/lib/api_client.dart b/mobile/openapi/lib/api_client.dart index 38abf7d481..ca7f232b22 100644 --- a/mobile/openapi/lib/api_client.dart +++ b/mobile/openapi/lib/api_client.dart @@ -350,6 +350,8 @@ class ApiClient { return CreateProfileImageResponseDto.fromJson(value); case 'CropParameters': return CropParameters.fromJson(value); + case 'DatabaseBackup': + return DatabaseBackupTypeTransformer().decode(value); case 'DatabaseBackupConfig': return DatabaseBackupConfig.fromJson(value); case 'DownloadArchiveInfo': @@ -434,8 +436,12 @@ class ApiClient { return MemoriesResponse.fromJson(value); case 'MemoriesUpdate': return MemoriesUpdate.fromJson(value); + case 'MemoryCleanup': + return MemoryCleanupTypeTransformer().decode(value); case 'MemoryCreateDto': return MemoryCreateDto.fromJson(value); + case 'MemoryGenerate': + return MemoryGenerateTypeTransformer().decode(value); case 'MemoryResponseDto': return MemoryResponseDto.fromJson(value); case 'MemorySearchOrder': @@ -504,6 +510,8 @@ class ApiClient { return PeopleUpdateItem.fromJson(value); case 'Permission': return PermissionTypeTransformer().decode(value); + case 'PersonCleanup': + return PersonCleanupTypeTransformer().decode(value); case 'PersonCreateDto': return PersonCreateDto.fromJson(value); case 'PersonResponseDto': @@ -792,6 +800,8 @@ class ApiClient { return TagBulkAssetsDto.fromJson(value); case 'TagBulkAssetsResponseDto': return TagBulkAssetsResponseDto.fromJson(value); + case 'TagCleanup': + return TagCleanupTypeTransformer().decode(value); case 'TagCreateDto': return TagCreateDto.fromJson(value); case 'TagResponseDto': @@ -842,6 +852,8 @@ class ApiClient { return UserAdminUpdateDto.fromJson(value); case 'UserAvatarColor': return UserAvatarColorTypeTransformer().decode(value); + case 'UserDeleteCheck': + return UserDeleteCheckTypeTransformer().decode(value); case 'UserLicense': return UserLicense.fromJson(value); case 'UserMetadataKey': diff --git a/mobile/openapi/lib/api_helper.dart b/mobile/openapi/lib/api_helper.dart index 18fa3d5e31..20ecc3f0f9 100644 --- a/mobile/openapi/lib/api_helper.dart +++ b/mobile/openapi/lib/api_helper.dart @@ -91,6 +91,9 @@ String parameterToString(dynamic value) { if (value is Colorspace) { return ColorspaceTypeTransformer().encode(value).toString(); } + if (value is DatabaseBackup) { + return DatabaseBackupTypeTransformer().encode(value).toString(); + } if (value is ImageFormat) { return ImageFormatTypeTransformer().encode(value).toString(); } @@ -106,6 +109,12 @@ String parameterToString(dynamic value) { if (value is ManualJobName) { return ManualJobNameTypeTransformer().encode(value).toString(); } + if (value is MemoryCleanup) { + return MemoryCleanupTypeTransformer().encode(value).toString(); + } + if (value is MemoryGenerate) { + return MemoryGenerateTypeTransformer().encode(value).toString(); + } if (value is MemorySearchOrder) { return MemorySearchOrderTypeTransformer().encode(value).toString(); } @@ -130,6 +139,9 @@ String parameterToString(dynamic value) { if (value is Permission) { return PermissionTypeTransformer().encode(value).toString(); } + if (value is PersonCleanup) { + return PersonCleanupTypeTransformer().encode(value).toString(); + } if (value is PluginContextType) { return PluginContextTypeTypeTransformer().encode(value).toString(); } @@ -166,6 +178,9 @@ String parameterToString(dynamic value) { if (value is SyncRequestType) { return SyncRequestTypeTypeTransformer().encode(value).toString(); } + if (value is TagCleanup) { + return TagCleanupTypeTransformer().encode(value).toString(); + } if (value is ToneMapping) { return ToneMappingTypeTransformer().encode(value).toString(); } @@ -178,6 +193,9 @@ String parameterToString(dynamic value) { if (value is UserAvatarColor) { return UserAvatarColorTypeTransformer().encode(value).toString(); } + if (value is UserDeleteCheck) { + return UserDeleteCheckTypeTransformer().encode(value).toString(); + } if (value is UserMetadataKey) { return UserMetadataKeyTypeTransformer().encode(value).toString(); } diff --git a/mobile/openapi/lib/model/database_backup.dart b/mobile/openapi/lib/model/database_backup.dart new file mode 100644 index 0000000000..3a08078574 --- /dev/null +++ b/mobile/openapi/lib/model/database_backup.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// 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 DatabaseBackup { + /// Instantiate a new enum with the provided [value]. + const DatabaseBackup._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const databaseBackup = DatabaseBackup._(r'DatabaseBackup'); + + /// List of all possible values in this [enum][DatabaseBackup]. + static const values = [ + databaseBackup, + ]; + + static DatabaseBackup? fromJson(dynamic value) => DatabaseBackupTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = DatabaseBackup.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [DatabaseBackup] to String, +/// and [decode] dynamic data back to [DatabaseBackup]. +class DatabaseBackupTypeTransformer { + factory DatabaseBackupTypeTransformer() => _instance ??= const DatabaseBackupTypeTransformer._(); + + const DatabaseBackupTypeTransformer._(); + + String encode(DatabaseBackup data) => data.value; + + /// Decodes a [dynamic value][data] to a DatabaseBackup. + /// + /// 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. + DatabaseBackup? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case r'DatabaseBackup': return DatabaseBackup.databaseBackup; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [DatabaseBackupTypeTransformer] instance. + static DatabaseBackupTypeTransformer? _instance; +} + diff --git a/mobile/openapi/lib/model/job_database_backup.dart b/mobile/openapi/lib/model/job_database_backup.dart index 80060400ef..c1c8a92b5c 100644 --- a/mobile/openapi/lib/model/job_database_backup.dart +++ b/mobile/openapi/lib/model/job_database_backup.dart @@ -19,7 +19,7 @@ class JobDatabaseBackup { BaseJobData data; - num name; + DatabaseBackup name; @override bool operator ==(Object other) => identical(this, other) || other is JobDatabaseBackup && @@ -52,7 +52,7 @@ class JobDatabaseBackup { return JobDatabaseBackup( data: BaseJobData.fromJson(json[r'data'])!, - name: num.parse('${json[r'name']}'), + name: DatabaseBackup.fromJson(json[r'name'])!, ); } return null; diff --git a/mobile/openapi/lib/model/job_memory_cleanup.dart b/mobile/openapi/lib/model/job_memory_cleanup.dart index dff75ab50f..af36a3e6db 100644 --- a/mobile/openapi/lib/model/job_memory_cleanup.dart +++ b/mobile/openapi/lib/model/job_memory_cleanup.dart @@ -19,7 +19,7 @@ class JobMemoryCleanup { BaseJobData data; - num name; + MemoryCleanup name; @override bool operator ==(Object other) => identical(this, other) || other is JobMemoryCleanup && @@ -52,7 +52,7 @@ class JobMemoryCleanup { return JobMemoryCleanup( data: BaseJobData.fromJson(json[r'data'])!, - name: num.parse('${json[r'name']}'), + name: MemoryCleanup.fromJson(json[r'name'])!, ); } return null; diff --git a/mobile/openapi/lib/model/job_memory_generate.dart b/mobile/openapi/lib/model/job_memory_generate.dart index 37d4d24be6..a78cf274e5 100644 --- a/mobile/openapi/lib/model/job_memory_generate.dart +++ b/mobile/openapi/lib/model/job_memory_generate.dart @@ -19,7 +19,7 @@ class JobMemoryGenerate { BaseJobData data; - num name; + MemoryGenerate name; @override bool operator ==(Object other) => identical(this, other) || other is JobMemoryGenerate && @@ -52,7 +52,7 @@ class JobMemoryGenerate { return JobMemoryGenerate( data: BaseJobData.fromJson(json[r'data'])!, - name: num.parse('${json[r'name']}'), + name: MemoryGenerate.fromJson(json[r'name'])!, ); } return null; diff --git a/mobile/openapi/lib/model/job_person_cleanup.dart b/mobile/openapi/lib/model/job_person_cleanup.dart index d97df0d52e..6bd9a8f644 100644 --- a/mobile/openapi/lib/model/job_person_cleanup.dart +++ b/mobile/openapi/lib/model/job_person_cleanup.dart @@ -19,7 +19,7 @@ class JobPersonCleanup { BaseJobData data; - num name; + PersonCleanup name; @override bool operator ==(Object other) => identical(this, other) || other is JobPersonCleanup && @@ -52,7 +52,7 @@ class JobPersonCleanup { return JobPersonCleanup( data: BaseJobData.fromJson(json[r'data'])!, - name: num.parse('${json[r'name']}'), + name: PersonCleanup.fromJson(json[r'name'])!, ); } return null; diff --git a/mobile/openapi/lib/model/job_tag_cleanup.dart b/mobile/openapi/lib/model/job_tag_cleanup.dart index 0ade0baeb4..455f3f7540 100644 --- a/mobile/openapi/lib/model/job_tag_cleanup.dart +++ b/mobile/openapi/lib/model/job_tag_cleanup.dart @@ -19,7 +19,7 @@ class JobTagCleanup { BaseJobData data; - num name; + TagCleanup name; @override bool operator ==(Object other) => identical(this, other) || other is JobTagCleanup && @@ -52,7 +52,7 @@ class JobTagCleanup { return JobTagCleanup( data: BaseJobData.fromJson(json[r'data'])!, - name: num.parse('${json[r'name']}'), + name: TagCleanup.fromJson(json[r'name'])!, ); } return null; diff --git a/mobile/openapi/lib/model/job_user_delete_check.dart b/mobile/openapi/lib/model/job_user_delete_check.dart index df6bfcd30f..8c7b501a08 100644 --- a/mobile/openapi/lib/model/job_user_delete_check.dart +++ b/mobile/openapi/lib/model/job_user_delete_check.dart @@ -19,7 +19,7 @@ class JobUserDeleteCheck { BaseJobData data; - num name; + UserDeleteCheck name; @override bool operator ==(Object other) => identical(this, other) || other is JobUserDeleteCheck && @@ -52,7 +52,7 @@ class JobUserDeleteCheck { return JobUserDeleteCheck( data: BaseJobData.fromJson(json[r'data'])!, - name: num.parse('${json[r'name']}'), + name: UserDeleteCheck.fromJson(json[r'name'])!, ); } return null; diff --git a/mobile/openapi/lib/model/memory_cleanup.dart b/mobile/openapi/lib/model/memory_cleanup.dart new file mode 100644 index 0000000000..6988ef38a7 --- /dev/null +++ b/mobile/openapi/lib/model/memory_cleanup.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// 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 MemoryCleanup { + /// Instantiate a new enum with the provided [value]. + const MemoryCleanup._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const memoryCleanup = MemoryCleanup._(r'MemoryCleanup'); + + /// List of all possible values in this [enum][MemoryCleanup]. + static const values = [ + memoryCleanup, + ]; + + static MemoryCleanup? fromJson(dynamic value) => MemoryCleanupTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = MemoryCleanup.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [MemoryCleanup] to String, +/// and [decode] dynamic data back to [MemoryCleanup]. +class MemoryCleanupTypeTransformer { + factory MemoryCleanupTypeTransformer() => _instance ??= const MemoryCleanupTypeTransformer._(); + + const MemoryCleanupTypeTransformer._(); + + String encode(MemoryCleanup data) => data.value; + + /// Decodes a [dynamic value][data] to a MemoryCleanup. + /// + /// 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. + MemoryCleanup? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case r'MemoryCleanup': return MemoryCleanup.memoryCleanup; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [MemoryCleanupTypeTransformer] instance. + static MemoryCleanupTypeTransformer? _instance; +} + diff --git a/mobile/openapi/lib/model/memory_generate.dart b/mobile/openapi/lib/model/memory_generate.dart new file mode 100644 index 0000000000..d4c2f48544 --- /dev/null +++ b/mobile/openapi/lib/model/memory_generate.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// 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 MemoryGenerate { + /// Instantiate a new enum with the provided [value]. + const MemoryGenerate._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const memoryGenerate = MemoryGenerate._(r'MemoryGenerate'); + + /// List of all possible values in this [enum][MemoryGenerate]. + static const values = [ + memoryGenerate, + ]; + + static MemoryGenerate? fromJson(dynamic value) => MemoryGenerateTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = MemoryGenerate.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [MemoryGenerate] to String, +/// and [decode] dynamic data back to [MemoryGenerate]. +class MemoryGenerateTypeTransformer { + factory MemoryGenerateTypeTransformer() => _instance ??= const MemoryGenerateTypeTransformer._(); + + const MemoryGenerateTypeTransformer._(); + + String encode(MemoryGenerate data) => data.value; + + /// Decodes a [dynamic value][data] to a MemoryGenerate. + /// + /// 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. + MemoryGenerate? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case r'MemoryGenerate': return MemoryGenerate.memoryGenerate; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [MemoryGenerateTypeTransformer] instance. + static MemoryGenerateTypeTransformer? _instance; +} + diff --git a/mobile/openapi/lib/model/person_cleanup.dart b/mobile/openapi/lib/model/person_cleanup.dart new file mode 100644 index 0000000000..14da901b12 --- /dev/null +++ b/mobile/openapi/lib/model/person_cleanup.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// 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 PersonCleanup { + /// Instantiate a new enum with the provided [value]. + const PersonCleanup._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const personCleanup = PersonCleanup._(r'PersonCleanup'); + + /// List of all possible values in this [enum][PersonCleanup]. + static const values = [ + personCleanup, + ]; + + static PersonCleanup? fromJson(dynamic value) => PersonCleanupTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = PersonCleanup.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [PersonCleanup] to String, +/// and [decode] dynamic data back to [PersonCleanup]. +class PersonCleanupTypeTransformer { + factory PersonCleanupTypeTransformer() => _instance ??= const PersonCleanupTypeTransformer._(); + + const PersonCleanupTypeTransformer._(); + + String encode(PersonCleanup data) => data.value; + + /// Decodes a [dynamic value][data] to a PersonCleanup. + /// + /// 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. + PersonCleanup? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case r'PersonCleanup': return PersonCleanup.personCleanup; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [PersonCleanupTypeTransformer] instance. + static PersonCleanupTypeTransformer? _instance; +} + diff --git a/mobile/openapi/lib/model/queue_job_create_dto_job.dart b/mobile/openapi/lib/model/queue_job_create_dto_job.dart index f4f70a4618..ad45f17256 100644 --- a/mobile/openapi/lib/model/queue_job_create_dto_job.dart +++ b/mobile/openapi/lib/model/queue_job_create_dto_job.dart @@ -19,7 +19,7 @@ class QueueJobCreateDtoJob { BaseJobData data; - num name; + DatabaseBackup name; @override bool operator ==(Object other) => identical(this, other) || other is QueueJobCreateDtoJob && @@ -52,7 +52,7 @@ class QueueJobCreateDtoJob { return QueueJobCreateDtoJob( data: BaseJobData.fromJson(json[r'data'])!, - name: num.parse('${json[r'name']}'), + name: DatabaseBackup.fromJson(json[r'name'])!, ); } return null; diff --git a/mobile/openapi/lib/model/tag_cleanup.dart b/mobile/openapi/lib/model/tag_cleanup.dart new file mode 100644 index 0000000000..e7e322a66e --- /dev/null +++ b/mobile/openapi/lib/model/tag_cleanup.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// 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 TagCleanup { + /// Instantiate a new enum with the provided [value]. + const TagCleanup._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const tagCleanup = TagCleanup._(r'TagCleanup'); + + /// List of all possible values in this [enum][TagCleanup]. + static const values = [ + tagCleanup, + ]; + + static TagCleanup? fromJson(dynamic value) => TagCleanupTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = TagCleanup.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [TagCleanup] to String, +/// and [decode] dynamic data back to [TagCleanup]. +class TagCleanupTypeTransformer { + factory TagCleanupTypeTransformer() => _instance ??= const TagCleanupTypeTransformer._(); + + const TagCleanupTypeTransformer._(); + + String encode(TagCleanup data) => data.value; + + /// Decodes a [dynamic value][data] to a TagCleanup. + /// + /// 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. + TagCleanup? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case r'TagCleanup': return TagCleanup.tagCleanup; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [TagCleanupTypeTransformer] instance. + static TagCleanupTypeTransformer? _instance; +} + diff --git a/mobile/openapi/lib/model/user_delete_check.dart b/mobile/openapi/lib/model/user_delete_check.dart new file mode 100644 index 0000000000..66b3d3373c --- /dev/null +++ b/mobile/openapi/lib/model/user_delete_check.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// 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 UserDeleteCheck { + /// Instantiate a new enum with the provided [value]. + const UserDeleteCheck._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const userDeleteCheck = UserDeleteCheck._(r'UserDeleteCheck'); + + /// List of all possible values in this [enum][UserDeleteCheck]. + static const values = [ + userDeleteCheck, + ]; + + static UserDeleteCheck? fromJson(dynamic value) => UserDeleteCheckTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = UserDeleteCheck.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [UserDeleteCheck] to String, +/// and [decode] dynamic data back to [UserDeleteCheck]. +class UserDeleteCheckTypeTransformer { + factory UserDeleteCheckTypeTransformer() => _instance ??= const UserDeleteCheckTypeTransformer._(); + + const UserDeleteCheckTypeTransformer._(); + + String encode(UserDeleteCheck data) => data.value; + + /// Decodes a [dynamic value][data] to a UserDeleteCheck. + /// + /// 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. + UserDeleteCheck? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case r'UserDeleteCheck': return UserDeleteCheck.userDeleteCheck; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [UserDeleteCheckTypeTransformer] instance. + static UserDeleteCheckTypeTransformer? _instance; +} + diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.json index 6c47bc7c16..fd6dffa8bf 100644 --- a/open-api/immich-openapi-specs.json +++ b/open-api/immich-openapi-specs.json @@ -16872,6 +16872,12 @@ ], "type": "object" }, + "DatabaseBackup": { + "enum": [ + "DatabaseBackup" + ], + "type": "string" + }, "DatabaseBackupConfig": { "properties": { "cronExpression": { @@ -17269,8 +17275,11 @@ "$ref": "#/components/schemas/BaseJobData" }, "name": { - "enum": [], - "type": "number" + "allOf": [ + { + "$ref": "#/components/schemas/DatabaseBackup" + } + ] } }, "required": [ @@ -17285,8 +17294,11 @@ "$ref": "#/components/schemas/BaseJobData" }, "name": { - "enum": [], - "type": "number" + "allOf": [ + { + "$ref": "#/components/schemas/MemoryCleanup" + } + ] } }, "required": [ @@ -17301,8 +17313,11 @@ "$ref": "#/components/schemas/BaseJobData" }, "name": { - "enum": [], - "type": "number" + "allOf": [ + { + "$ref": "#/components/schemas/MemoryGenerate" + } + ] } }, "required": [ @@ -17378,8 +17393,11 @@ "$ref": "#/components/schemas/BaseJobData" }, "name": { - "enum": [], - "type": "number" + "allOf": [ + { + "$ref": "#/components/schemas/PersonCleanup" + } + ] } }, "required": [ @@ -17406,8 +17424,11 @@ "$ref": "#/components/schemas/BaseJobData" }, "name": { - "enum": [], - "type": "number" + "allOf": [ + { + "$ref": "#/components/schemas/TagCleanup" + } + ] } }, "required": [ @@ -17422,8 +17443,11 @@ "$ref": "#/components/schemas/BaseJobData" }, "name": { - "enum": [], - "type": "number" + "allOf": [ + { + "$ref": "#/components/schemas/UserDeleteCheck" + } + ] } }, "required": [ @@ -17776,6 +17800,12 @@ }, "type": "object" }, + "MemoryCleanup": { + "enum": [ + "MemoryCleanup" + ], + "type": "string" + }, "MemoryCreateDto": { "properties": { "assetIds": { @@ -17814,6 +17844,12 @@ ], "type": "object" }, + "MemoryGenerate": { + "enum": [ + "MemoryGenerate" + ], + "type": "string" + }, "MemoryResponseDto": { "properties": { "assets": { @@ -18759,6 +18795,12 @@ ], "type": "string" }, + "PersonCleanup": { + "enum": [ + "PersonCleanup" + ], + "type": "string" + }, "PersonCreateDto": { "properties": { "birthDate": { @@ -23012,6 +23054,12 @@ ], "type": "object" }, + "TagCleanup": { + "enum": [ + "TagCleanup" + ], + "type": "string" + }, "TagCreateDto": { "properties": { "color": { @@ -23733,6 +23781,12 @@ ], "type": "string" }, + "UserDeleteCheck": { + "enum": [ + "UserDeleteCheck" + ], + "type": "string" + }, "UserLicense": { "properties": { "activatedAt": { diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.ts index 627d22e8d1..3722b0337b 100644 --- a/open-api/typescript-sdk/src/fetch-client.ts +++ b/open-api/typescript-sdk/src/fetch-client.ts @@ -1043,27 +1043,27 @@ export type BaseJobData = { }; export type JobTagCleanup = { data: BaseJobData; - name: Name; + name: TagCleanup; }; export type JobPersonCleanup = { data: BaseJobData; - name: Name; + name: PersonCleanup; }; export type JobUserDeleteCheck = { data: BaseJobData; - name: Name; + name: UserDeleteCheck; }; export type JobMemoryCleanup = { data: BaseJobData; - name: Name; + name: MemoryCleanup; }; export type JobMemoryGenerate = { data: BaseJobData; - name: Name; + name: MemoryGenerate; }; export type JobDatabaseBackup = { data: BaseJobData; - name: Name; + name: DatabaseBackup; }; export type QueueJobCreateDto = { job: JobTagCleanup | JobPersonCleanup | JobUserDeleteCheck | JobMemoryCleanup | JobMemoryGenerate | JobDatabaseBackup; @@ -5636,7 +5636,23 @@ export enum PluginTriggerType { AssetCreate = "AssetCreate", PersonRecognized = "PersonRecognized" } -export enum Name { +export enum TagCleanup { + TagCleanup = "TagCleanup" +} +export enum PersonCleanup { + PersonCleanup = "PersonCleanup" +} +export enum UserDeleteCheck { + UserDeleteCheck = "UserDeleteCheck" +} +export enum MemoryCleanup { + MemoryCleanup = "MemoryCleanup" +} +export enum MemoryGenerate { + MemoryGenerate = "MemoryGenerate" +} +export enum DatabaseBackup { + DatabaseBackup = "DatabaseBackup" } export enum QueueJobStatus { Active = "active", diff --git a/server/src/dtos/queue.dto.ts b/server/src/dtos/queue.dto.ts index 95e922711c..3fa225723d 100644 --- a/server/src/dtos/queue.dto.ts +++ b/server/src/dtos/queue.dto.ts @@ -18,31 +18,37 @@ class BaseJob { } class JobTagCleanup extends BaseJob { + @ApiProperty({ enumName: JobName.TagCleanup, enum: [JobName.TagCleanup] }) @Equals(JobName.TagCleanup) name!: JobName.TagCleanup; } class JobPersonCleanup extends BaseJob { + @ApiProperty({ enumName: JobName.PersonCleanup, enum: [JobName.PersonCleanup] }) @Equals(JobName.PersonCleanup) name!: JobName.PersonCleanup; } class JobUserDeleteCheck extends BaseJob { + @ApiProperty({ enumName: JobName.UserDeleteCheck, enum: [JobName.UserDeleteCheck] }) @Equals(JobName.UserDeleteCheck) name!: JobName.UserDeleteCheck; } class JobMemoryCleanup extends BaseJob { + @ApiProperty({ enumName: JobName.MemoryCleanup, enum: [JobName.MemoryCleanup] }) @Equals(JobName.MemoryCleanup) name!: JobName.MemoryCleanup; } class JobMemoryGenerate extends BaseJob { + @ApiProperty({ enumName: JobName.MemoryGenerate, enum: [JobName.MemoryGenerate] }) @Equals(JobName.MemoryGenerate) name!: JobName.MemoryGenerate; } class JobDatabaseBackup extends BaseJob { + @ApiProperty({ enumName: JobName.DatabaseBackup, enum: [JobName.DatabaseBackup] }) @Equals(JobName.DatabaseBackup) name!: JobName.DatabaseBackup; }