diff --git a/mobile/openapi/README.md b/mobile/openapi/README.md index f292ed494a..8b63596108 100644 --- a/mobile/openapi/README.md +++ b/mobile/openapi/README.md @@ -407,6 +407,10 @@ Class | Method | HTTP request | Description - [FoldersResponse](doc//FoldersResponse.md) - [FoldersUpdate](doc//FoldersUpdate.md) - [ImageFormat](doc//ImageFormat.md) + - [IntegrityGetReportDto](doc//IntegrityGetReportDto.md) + - [IntegrityReportDto](doc//IntegrityReportDto.md) + - [IntegrityReportResponseDto](doc//IntegrityReportResponseDto.md) + - [IntegrityReportSummaryResponseDto](doc//IntegrityReportSummaryResponseDto.md) - [IntegrityReportType](doc//IntegrityReportType.md) - [JobCreateDto](doc//JobCreateDto.md) - [JobName](doc//JobName.md) @@ -422,10 +426,6 @@ Class | Method | HTTP request | Description - [MachineLearningAvailabilityChecksDto](doc//MachineLearningAvailabilityChecksDto.md) - [MaintenanceAction](doc//MaintenanceAction.md) - [MaintenanceAuthDto](doc//MaintenanceAuthDto.md) - - [MaintenanceGetIntegrityReportDto](doc//MaintenanceGetIntegrityReportDto.md) - - [MaintenanceIntegrityReportDto](doc//MaintenanceIntegrityReportDto.md) - - [MaintenanceIntegrityReportResponseDto](doc//MaintenanceIntegrityReportResponseDto.md) - - [MaintenanceIntegrityReportSummaryResponseDto](doc//MaintenanceIntegrityReportSummaryResponseDto.md) - [MaintenanceLoginDto](doc//MaintenanceLoginDto.md) - [ManualJobName](doc//ManualJobName.md) - [MapMarkerResponseDto](doc//MapMarkerResponseDto.md) diff --git a/mobile/openapi/lib/api.dart b/mobile/openapi/lib/api.dart index 3ee5e5c886..1d5831de5b 100644 --- a/mobile/openapi/lib/api.dart +++ b/mobile/openapi/lib/api.dart @@ -154,6 +154,10 @@ part 'model/facial_recognition_config.dart'; part 'model/folders_response.dart'; part 'model/folders_update.dart'; part 'model/image_format.dart'; +part 'model/integrity_get_report_dto.dart'; +part 'model/integrity_report_dto.dart'; +part 'model/integrity_report_response_dto.dart'; +part 'model/integrity_report_summary_response_dto.dart'; part 'model/integrity_report_type.dart'; part 'model/job_create_dto.dart'; part 'model/job_name.dart'; @@ -169,10 +173,6 @@ part 'model/logout_response_dto.dart'; part 'model/machine_learning_availability_checks_dto.dart'; part 'model/maintenance_action.dart'; part 'model/maintenance_auth_dto.dart'; -part 'model/maintenance_get_integrity_report_dto.dart'; -part 'model/maintenance_integrity_report_dto.dart'; -part 'model/maintenance_integrity_report_response_dto.dart'; -part 'model/maintenance_integrity_report_summary_response_dto.dart'; part 'model/maintenance_login_dto.dart'; part 'model/manual_job_name.dart'; part 'model/map_marker_response_dto.dart'; diff --git a/mobile/openapi/lib/api/maintenance_admin_api.dart b/mobile/openapi/lib/api/maintenance_admin_api.dart index c51923b334..ed9dbf0a2d 100644 --- a/mobile/openapi/lib/api/maintenance_admin_api.dart +++ b/mobile/openapi/lib/api/maintenance_admin_api.dart @@ -73,13 +73,13 @@ class MaintenanceAdminApi { /// /// Parameters: /// - /// * [MaintenanceGetIntegrityReportDto] maintenanceGetIntegrityReportDto (required): - Future getIntegrityReportWithHttpInfo(MaintenanceGetIntegrityReportDto maintenanceGetIntegrityReportDto,) async { + /// * [IntegrityGetReportDto] integrityGetReportDto (required): + Future getIntegrityReportWithHttpInfo(IntegrityGetReportDto integrityGetReportDto,) async { // ignore: prefer_const_declarations final apiPath = r'/admin/integrity/report'; // ignore: prefer_final_locals - Object? postBody = maintenanceGetIntegrityReportDto; + Object? postBody = integrityGetReportDto; final queryParams = []; final headerParams = {}; @@ -105,9 +105,9 @@ class MaintenanceAdminApi { /// /// Parameters: /// - /// * [MaintenanceGetIntegrityReportDto] maintenanceGetIntegrityReportDto (required): - Future getIntegrityReport(MaintenanceGetIntegrityReportDto maintenanceGetIntegrityReportDto,) async { - final response = await getIntegrityReportWithHttpInfo(maintenanceGetIntegrityReportDto,); + /// * [IntegrityGetReportDto] integrityGetReportDto (required): + Future getIntegrityReport(IntegrityGetReportDto integrityGetReportDto,) async { + final response = await getIntegrityReportWithHttpInfo(integrityGetReportDto,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } @@ -115,7 +115,7 @@ class MaintenanceAdminApi { // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { - return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'MaintenanceIntegrityReportResponseDto',) as MaintenanceIntegrityReportResponseDto; + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'IntegrityReportResponseDto',) as IntegrityReportResponseDto; } return null; @@ -268,7 +268,7 @@ class MaintenanceAdminApi { /// Get integrity report summary /// /// ... - Future getIntegrityReportSummary() async { + Future getIntegrityReportSummary() async { final response = await getIntegrityReportSummaryWithHttpInfo(); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -277,7 +277,7 @@ class MaintenanceAdminApi { // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { - return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'MaintenanceIntegrityReportSummaryResponseDto',) as MaintenanceIntegrityReportSummaryResponseDto; + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'IntegrityReportSummaryResponseDto',) as IntegrityReportSummaryResponseDto; } return null; diff --git a/mobile/openapi/lib/api_client.dart b/mobile/openapi/lib/api_client.dart index 889c18bde0..64f1c6b836 100644 --- a/mobile/openapi/lib/api_client.dart +++ b/mobile/openapi/lib/api_client.dart @@ -356,6 +356,14 @@ class ApiClient { return FoldersUpdate.fromJson(value); case 'ImageFormat': return ImageFormatTypeTransformer().decode(value); + case 'IntegrityGetReportDto': + return IntegrityGetReportDto.fromJson(value); + case 'IntegrityReportDto': + return IntegrityReportDto.fromJson(value); + case 'IntegrityReportResponseDto': + return IntegrityReportResponseDto.fromJson(value); + case 'IntegrityReportSummaryResponseDto': + return IntegrityReportSummaryResponseDto.fromJson(value); case 'IntegrityReportType': return IntegrityReportTypeTypeTransformer().decode(value); case 'JobCreateDto': @@ -386,14 +394,6 @@ class ApiClient { return MaintenanceActionTypeTransformer().decode(value); case 'MaintenanceAuthDto': return MaintenanceAuthDto.fromJson(value); - case 'MaintenanceGetIntegrityReportDto': - return MaintenanceGetIntegrityReportDto.fromJson(value); - case 'MaintenanceIntegrityReportDto': - return MaintenanceIntegrityReportDto.fromJson(value); - case 'MaintenanceIntegrityReportResponseDto': - return MaintenanceIntegrityReportResponseDto.fromJson(value); - case 'MaintenanceIntegrityReportSummaryResponseDto': - return MaintenanceIntegrityReportSummaryResponseDto.fromJson(value); case 'MaintenanceLoginDto': return MaintenanceLoginDto.fromJson(value); case 'ManualJobName': diff --git a/mobile/openapi/lib/model/maintenance_get_integrity_report_dto.dart b/mobile/openapi/lib/model/integrity_get_report_dto.dart similarity index 56% rename from mobile/openapi/lib/model/maintenance_get_integrity_report_dto.dart rename to mobile/openapi/lib/model/integrity_get_report_dto.dart index 691daa5ea7..75fb7bb952 100644 --- a/mobile/openapi/lib/model/maintenance_get_integrity_report_dto.dart +++ b/mobile/openapi/lib/model/integrity_get_report_dto.dart @@ -10,16 +10,16 @@ part of openapi.api; -class MaintenanceGetIntegrityReportDto { - /// Returns a new [MaintenanceGetIntegrityReportDto] instance. - MaintenanceGetIntegrityReportDto({ +class IntegrityGetReportDto { + /// Returns a new [IntegrityGetReportDto] instance. + IntegrityGetReportDto({ required this.type, }); IntegrityReportType type; @override - bool operator ==(Object other) => identical(this, other) || other is MaintenanceGetIntegrityReportDto && + bool operator ==(Object other) => identical(this, other) || other is IntegrityGetReportDto && other.type == type; @override @@ -28,7 +28,7 @@ class MaintenanceGetIntegrityReportDto { (type.hashCode); @override - String toString() => 'MaintenanceGetIntegrityReportDto[type=$type]'; + String toString() => 'IntegrityGetReportDto[type=$type]'; Map toJson() { final json = {}; @@ -36,26 +36,26 @@ class MaintenanceGetIntegrityReportDto { return json; } - /// Returns a new [MaintenanceGetIntegrityReportDto] instance and imports its values from + /// Returns a new [IntegrityGetReportDto] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static MaintenanceGetIntegrityReportDto? fromJson(dynamic value) { - upgradeDto(value, "MaintenanceGetIntegrityReportDto"); + static IntegrityGetReportDto? fromJson(dynamic value) { + upgradeDto(value, "IntegrityGetReportDto"); if (value is Map) { final json = value.cast(); - return MaintenanceGetIntegrityReportDto( + return IntegrityGetReportDto( type: IntegrityReportType.fromJson(json[r'type'])!, ); } return null; } - static List listFromJson(dynamic json, {bool growable = false,}) { - final result = []; + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { - final value = MaintenanceGetIntegrityReportDto.fromJson(row); + final value = IntegrityGetReportDto.fromJson(row); if (value != null) { result.add(value); } @@ -64,12 +64,12 @@ class MaintenanceGetIntegrityReportDto { return result.toList(growable: growable); } - static Map mapFromJson(dynamic json) { - final map = {}; + static Map mapFromJson(dynamic json) { + final map = {}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = MaintenanceGetIntegrityReportDto.fromJson(entry.value); + final value = IntegrityGetReportDto.fromJson(entry.value); if (value != null) { map[entry.key] = value; } @@ -78,14 +78,14 @@ class MaintenanceGetIntegrityReportDto { return map; } - // maps a json object with a list of MaintenanceGetIntegrityReportDto-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool growable = false,}) { - final map = >{}; + // maps a json object with a list of IntegrityGetReportDto-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; if (json is Map && json.isNotEmpty) { // ignore: parameter_assignments json = json.cast(); for (final entry in json.entries) { - map[entry.key] = MaintenanceGetIntegrityReportDto.listFromJson(entry.value, growable: growable,); + map[entry.key] = IntegrityGetReportDto.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mobile/openapi/lib/model/maintenance_integrity_report_dto.dart b/mobile/openapi/lib/model/integrity_report_dto.dart similarity index 61% rename from mobile/openapi/lib/model/maintenance_integrity_report_dto.dart rename to mobile/openapi/lib/model/integrity_report_dto.dart index 777a6f0534..4b3db429ac 100644 --- a/mobile/openapi/lib/model/maintenance_integrity_report_dto.dart +++ b/mobile/openapi/lib/model/integrity_report_dto.dart @@ -10,9 +10,9 @@ part of openapi.api; -class MaintenanceIntegrityReportDto { - /// Returns a new [MaintenanceIntegrityReportDto] instance. - MaintenanceIntegrityReportDto({ +class IntegrityReportDto { + /// Returns a new [IntegrityReportDto] instance. + IntegrityReportDto({ required this.id, required this.path, required this.type, @@ -25,7 +25,7 @@ class MaintenanceIntegrityReportDto { IntegrityReportType type; @override - bool operator ==(Object other) => identical(this, other) || other is MaintenanceIntegrityReportDto && + bool operator ==(Object other) => identical(this, other) || other is IntegrityReportDto && other.id == id && other.path == path && other.type == type; @@ -38,7 +38,7 @@ class MaintenanceIntegrityReportDto { (type.hashCode); @override - String toString() => 'MaintenanceIntegrityReportDto[id=$id, path=$path, type=$type]'; + String toString() => 'IntegrityReportDto[id=$id, path=$path, type=$type]'; Map toJson() { final json = {}; @@ -48,15 +48,15 @@ class MaintenanceIntegrityReportDto { return json; } - /// Returns a new [MaintenanceIntegrityReportDto] instance and imports its values from + /// Returns a new [IntegrityReportDto] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static MaintenanceIntegrityReportDto? fromJson(dynamic value) { - upgradeDto(value, "MaintenanceIntegrityReportDto"); + static IntegrityReportDto? fromJson(dynamic value) { + upgradeDto(value, "IntegrityReportDto"); if (value is Map) { final json = value.cast(); - return MaintenanceIntegrityReportDto( + return IntegrityReportDto( id: mapValueOfType(json, r'id')!, path: mapValueOfType(json, r'path')!, type: IntegrityReportType.fromJson(json[r'type'])!, @@ -65,11 +65,11 @@ class MaintenanceIntegrityReportDto { return null; } - static List listFromJson(dynamic json, {bool growable = false,}) { - final result = []; + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { - final value = MaintenanceIntegrityReportDto.fromJson(row); + final value = IntegrityReportDto.fromJson(row); if (value != null) { result.add(value); } @@ -78,12 +78,12 @@ class MaintenanceIntegrityReportDto { return result.toList(growable: growable); } - static Map mapFromJson(dynamic json) { - final map = {}; + static Map mapFromJson(dynamic json) { + final map = {}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = MaintenanceIntegrityReportDto.fromJson(entry.value); + final value = IntegrityReportDto.fromJson(entry.value); if (value != null) { map[entry.key] = value; } @@ -92,14 +92,14 @@ class MaintenanceIntegrityReportDto { return map; } - // maps a json object with a list of MaintenanceIntegrityReportDto-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool growable = false,}) { - final map = >{}; + // maps a json object with a list of IntegrityReportDto-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; if (json is Map && json.isNotEmpty) { // ignore: parameter_assignments json = json.cast(); for (final entry in json.entries) { - map[entry.key] = MaintenanceIntegrityReportDto.listFromJson(entry.value, growable: growable,); + map[entry.key] = IntegrityReportDto.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mobile/openapi/lib/model/maintenance_integrity_report_response_dto.dart b/mobile/openapi/lib/model/integrity_report_response_dto.dart similarity index 51% rename from mobile/openapi/lib/model/maintenance_integrity_report_response_dto.dart rename to mobile/openapi/lib/model/integrity_report_response_dto.dart index 7d76a05db6..45213f39e0 100644 --- a/mobile/openapi/lib/model/maintenance_integrity_report_response_dto.dart +++ b/mobile/openapi/lib/model/integrity_report_response_dto.dart @@ -10,16 +10,16 @@ part of openapi.api; -class MaintenanceIntegrityReportResponseDto { - /// Returns a new [MaintenanceIntegrityReportResponseDto] instance. - MaintenanceIntegrityReportResponseDto({ +class IntegrityReportResponseDto { + /// Returns a new [IntegrityReportResponseDto] instance. + IntegrityReportResponseDto({ this.items = const [], }); - List items; + List items; @override - bool operator ==(Object other) => identical(this, other) || other is MaintenanceIntegrityReportResponseDto && + bool operator ==(Object other) => identical(this, other) || other is IntegrityReportResponseDto && _deepEquality.equals(other.items, items); @override @@ -28,7 +28,7 @@ class MaintenanceIntegrityReportResponseDto { (items.hashCode); @override - String toString() => 'MaintenanceIntegrityReportResponseDto[items=$items]'; + String toString() => 'IntegrityReportResponseDto[items=$items]'; Map toJson() { final json = {}; @@ -36,26 +36,26 @@ class MaintenanceIntegrityReportResponseDto { return json; } - /// Returns a new [MaintenanceIntegrityReportResponseDto] instance and imports its values from + /// Returns a new [IntegrityReportResponseDto] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static MaintenanceIntegrityReportResponseDto? fromJson(dynamic value) { - upgradeDto(value, "MaintenanceIntegrityReportResponseDto"); + static IntegrityReportResponseDto? fromJson(dynamic value) { + upgradeDto(value, "IntegrityReportResponseDto"); if (value is Map) { final json = value.cast(); - return MaintenanceIntegrityReportResponseDto( - items: MaintenanceIntegrityReportDto.listFromJson(json[r'items']), + return IntegrityReportResponseDto( + items: IntegrityReportDto.listFromJson(json[r'items']), ); } return null; } - static List listFromJson(dynamic json, {bool growable = false,}) { - final result = []; + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { - final value = MaintenanceIntegrityReportResponseDto.fromJson(row); + final value = IntegrityReportResponseDto.fromJson(row); if (value != null) { result.add(value); } @@ -64,12 +64,12 @@ class MaintenanceIntegrityReportResponseDto { return result.toList(growable: growable); } - static Map mapFromJson(dynamic json) { - final map = {}; + static Map mapFromJson(dynamic json) { + final map = {}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = MaintenanceIntegrityReportResponseDto.fromJson(entry.value); + final value = IntegrityReportResponseDto.fromJson(entry.value); if (value != null) { map[entry.key] = value; } @@ -78,14 +78,14 @@ class MaintenanceIntegrityReportResponseDto { return map; } - // maps a json object with a list of MaintenanceIntegrityReportResponseDto-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool growable = false,}) { - final map = >{}; + // maps a json object with a list of IntegrityReportResponseDto-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; if (json is Map && json.isNotEmpty) { // ignore: parameter_assignments json = json.cast(); for (final entry in json.entries) { - map[entry.key] = MaintenanceIntegrityReportResponseDto.listFromJson(entry.value, growable: growable,); + map[entry.key] = IntegrityReportResponseDto.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mobile/openapi/lib/model/maintenance_integrity_report_summary_response_dto.dart b/mobile/openapi/lib/model/integrity_report_summary_response_dto.dart similarity index 58% rename from mobile/openapi/lib/model/maintenance_integrity_report_summary_response_dto.dart rename to mobile/openapi/lib/model/integrity_report_summary_response_dto.dart index fbf53b9436..4b649b1328 100644 --- a/mobile/openapi/lib/model/maintenance_integrity_report_summary_response_dto.dart +++ b/mobile/openapi/lib/model/integrity_report_summary_response_dto.dart @@ -10,9 +10,9 @@ part of openapi.api; -class MaintenanceIntegrityReportSummaryResponseDto { - /// Returns a new [MaintenanceIntegrityReportSummaryResponseDto] instance. - MaintenanceIntegrityReportSummaryResponseDto({ +class IntegrityReportSummaryResponseDto { + /// Returns a new [IntegrityReportSummaryResponseDto] instance. + IntegrityReportSummaryResponseDto({ required this.checksumMismatch, required this.missingFile, required this.orphanFile, @@ -25,7 +25,7 @@ class MaintenanceIntegrityReportSummaryResponseDto { int orphanFile; @override - bool operator ==(Object other) => identical(this, other) || other is MaintenanceIntegrityReportSummaryResponseDto && + bool operator ==(Object other) => identical(this, other) || other is IntegrityReportSummaryResponseDto && other.checksumMismatch == checksumMismatch && other.missingFile == missingFile && other.orphanFile == orphanFile; @@ -38,7 +38,7 @@ class MaintenanceIntegrityReportSummaryResponseDto { (orphanFile.hashCode); @override - String toString() => 'MaintenanceIntegrityReportSummaryResponseDto[checksumMismatch=$checksumMismatch, missingFile=$missingFile, orphanFile=$orphanFile]'; + String toString() => 'IntegrityReportSummaryResponseDto[checksumMismatch=$checksumMismatch, missingFile=$missingFile, orphanFile=$orphanFile]'; Map toJson() { final json = {}; @@ -48,15 +48,15 @@ class MaintenanceIntegrityReportSummaryResponseDto { return json; } - /// Returns a new [MaintenanceIntegrityReportSummaryResponseDto] instance and imports its values from + /// Returns a new [IntegrityReportSummaryResponseDto] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static MaintenanceIntegrityReportSummaryResponseDto? fromJson(dynamic value) { - upgradeDto(value, "MaintenanceIntegrityReportSummaryResponseDto"); + static IntegrityReportSummaryResponseDto? fromJson(dynamic value) { + upgradeDto(value, "IntegrityReportSummaryResponseDto"); if (value is Map) { final json = value.cast(); - return MaintenanceIntegrityReportSummaryResponseDto( + return IntegrityReportSummaryResponseDto( checksumMismatch: mapValueOfType(json, r'checksum_mismatch')!, missingFile: mapValueOfType(json, r'missing_file')!, orphanFile: mapValueOfType(json, r'orphan_file')!, @@ -65,11 +65,11 @@ class MaintenanceIntegrityReportSummaryResponseDto { return null; } - static List listFromJson(dynamic json, {bool growable = false,}) { - final result = []; + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { - final value = MaintenanceIntegrityReportSummaryResponseDto.fromJson(row); + final value = IntegrityReportSummaryResponseDto.fromJson(row); if (value != null) { result.add(value); } @@ -78,12 +78,12 @@ class MaintenanceIntegrityReportSummaryResponseDto { return result.toList(growable: growable); } - static Map mapFromJson(dynamic json) { - final map = {}; + static Map mapFromJson(dynamic json) { + final map = {}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = MaintenanceIntegrityReportSummaryResponseDto.fromJson(entry.value); + final value = IntegrityReportSummaryResponseDto.fromJson(entry.value); if (value != null) { map[entry.key] = value; } @@ -92,14 +92,14 @@ class MaintenanceIntegrityReportSummaryResponseDto { return map; } - // maps a json object with a list of MaintenanceIntegrityReportSummaryResponseDto-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool growable = false,}) { - final map = >{}; + // maps a json object with a list of IntegrityReportSummaryResponseDto-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; if (json is Map && json.isNotEmpty) { // ignore: parameter_assignments json = json.cast(); for (final entry in json.entries) { - map[entry.key] = MaintenanceIntegrityReportSummaryResponseDto.listFromJson(entry.value, growable: growable,); + map[entry.key] = IntegrityReportSummaryResponseDto.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.json index cf41d9571c..6e38829b76 100644 --- a/open-api/immich-openapi-specs.json +++ b/open-api/immich-openapi-specs.json @@ -331,7 +331,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/MaintenanceGetIntegrityReportDto" + "$ref": "#/components/schemas/IntegrityGetReportDto" } } }, @@ -342,7 +342,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/MaintenanceIntegrityReportResponseDto" + "$ref": "#/components/schemas/IntegrityReportResponseDto" } } }, @@ -554,7 +554,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/MaintenanceIntegrityReportSummaryResponseDto" + "$ref": "#/components/schemas/IntegrityReportSummaryResponseDto" } } }, @@ -16862,6 +16862,77 @@ ], "type": "string" }, + "IntegrityGetReportDto": { + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/IntegrityReportType" + } + ] + } + }, + "required": [ + "type" + ], + "type": "object" + }, + "IntegrityReportDto": { + "properties": { + "id": { + "type": "string" + }, + "path": { + "type": "string" + }, + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/IntegrityReportType" + } + ] + } + }, + "required": [ + "id", + "path", + "type" + ], + "type": "object" + }, + "IntegrityReportResponseDto": { + "properties": { + "items": { + "items": { + "$ref": "#/components/schemas/IntegrityReportDto" + }, + "type": "array" + } + }, + "required": [ + "items" + ], + "type": "object" + }, + "IntegrityReportSummaryResponseDto": { + "properties": { + "checksum_mismatch": { + "type": "integer" + }, + "missing_file": { + "type": "integer" + }, + "orphan_file": { + "type": "integer" + } + }, + "required": [ + "checksum_mismatch", + "missing_file", + "orphan_file" + ], + "type": "object" + }, "IntegrityReportType": { "enum": [ "orphan_file", @@ -17204,77 +17275,6 @@ ], "type": "object" }, - "MaintenanceGetIntegrityReportDto": { - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/IntegrityReportType" - } - ] - } - }, - "required": [ - "type" - ], - "type": "object" - }, - "MaintenanceIntegrityReportDto": { - "properties": { - "id": { - "type": "string" - }, - "path": { - "type": "string" - }, - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/IntegrityReportType" - } - ] - } - }, - "required": [ - "id", - "path", - "type" - ], - "type": "object" - }, - "MaintenanceIntegrityReportResponseDto": { - "properties": { - "items": { - "items": { - "$ref": "#/components/schemas/MaintenanceIntegrityReportDto" - }, - "type": "array" - } - }, - "required": [ - "items" - ], - "type": "object" - }, - "MaintenanceIntegrityReportSummaryResponseDto": { - "properties": { - "checksum_mismatch": { - "type": "integer" - }, - "missing_file": { - "type": "integer" - }, - "orphan_file": { - "type": "integer" - } - }, - "required": [ - "checksum_mismatch", - "missing_file", - "orphan_file" - ], - "type": "object" - }, "MaintenanceLoginDto": { "properties": { "token": { diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.ts index d1836351f9..2f5317eebe 100644 --- a/open-api/typescript-sdk/src/fetch-client.ts +++ b/open-api/typescript-sdk/src/fetch-client.ts @@ -40,18 +40,18 @@ export type ActivityStatisticsResponseDto = { comments: number; likes: number; }; -export type MaintenanceGetIntegrityReportDto = { +export type IntegrityGetReportDto = { "type": IntegrityReportType; }; -export type MaintenanceIntegrityReportDto = { +export type IntegrityReportDto = { id: string; path: string; "type": IntegrityReportType; }; -export type MaintenanceIntegrityReportResponseDto = { - items: MaintenanceIntegrityReportDto[]; +export type IntegrityReportResponseDto = { + items: IntegrityReportDto[]; }; -export type MaintenanceIntegrityReportSummaryResponseDto = { +export type IntegrityReportSummaryResponseDto = { checksum_mismatch: number; missing_file: number; orphan_file: number; @@ -1887,16 +1887,16 @@ export function unlinkAllOAuthAccountsAdmin(opts?: Oazapfts.RequestOpts) { /** * Get integrity report by type */ -export function getIntegrityReport({ maintenanceGetIntegrityReportDto }: { - maintenanceGetIntegrityReportDto: MaintenanceGetIntegrityReportDto; +export function getIntegrityReport({ integrityGetReportDto }: { + integrityGetReportDto: IntegrityGetReportDto; }, opts?: Oazapfts.RequestOpts) { return oazapfts.ok(oazapfts.fetchJson<{ status: 201; - data: MaintenanceIntegrityReportResponseDto; + data: IntegrityReportResponseDto; }>("/admin/integrity/report", oazapfts.json({ ...opts, method: "POST", - body: maintenanceGetIntegrityReportDto + body: integrityGetReportDto }))); } /** @@ -1942,7 +1942,7 @@ export function getIntegrityReportCsv({ $type }: { export function getIntegrityReportSummary(opts?: Oazapfts.RequestOpts) { return oazapfts.ok(oazapfts.fetchJson<{ status: 200; - data: MaintenanceIntegrityReportSummaryResponseDto; + data: IntegrityReportSummaryResponseDto; }>("/admin/integrity/summary", { ...opts })); diff --git a/server/src/controllers/integrity.controller.ts b/server/src/controllers/integrity.controller.ts index 1ca2a689bd..84299899ab 100644 --- a/server/src/controllers/integrity.controller.ts +++ b/server/src/controllers/integrity.controller.ts @@ -4,10 +4,10 @@ import { NextFunction, Response } from 'express'; import { Endpoint, HistoryBuilder } from 'src/decorators'; import { AuthDto } from 'src/dtos/auth.dto'; import { - MaintenanceGetIntegrityReportDto, - MaintenanceIntegrityReportResponseDto, - MaintenanceIntegrityReportSummaryResponseDto, -} from 'src/dtos/maintenance.dto'; + IntegrityGetReportDto, + IntegrityReportResponseDto, + IntegrityReportSummaryResponseDto, +} from 'src/dtos/integrity.dto'; import { ApiTag, Permission } from 'src/enum'; import { Auth, Authenticated, FileResponse } from 'src/middleware/auth.guard'; import { LoggingRepository } from 'src/repositories/logging.repository'; @@ -30,7 +30,7 @@ export class IntegrityController { history: new HistoryBuilder().added('v9.9.9').alpha('v9.9.9'), }) @Authenticated({ permission: Permission.Maintenance, admin: true }) - getIntegrityReportSummary(): Promise { + getIntegrityReportSummary(): Promise { return this.service.getIntegrityReportSummary(); } @@ -41,7 +41,7 @@ export class IntegrityController { history: new HistoryBuilder().added('v9.9.9').alpha('v9.9.9'), }) @Authenticated({ permission: Permission.Maintenance, admin: true }) - getIntegrityReport(@Body() dto: MaintenanceGetIntegrityReportDto): Promise { + getIntegrityReport(@Body() dto: IntegrityGetReportDto): Promise { return this.service.getIntegrityReport(dto); } diff --git a/server/src/dtos/integrity.dto.ts b/server/src/dtos/integrity.dto.ts new file mode 100644 index 0000000000..9a51adbca0 --- /dev/null +++ b/server/src/dtos/integrity.dto.ts @@ -0,0 +1,40 @@ +import { ApiProperty } from '@nestjs/swagger'; +import { IntegrityReportType } from 'src/enum'; +import { ValidateEnum } from 'src/validation'; + +export class IntegrityReportSummaryResponseDto { + @ApiProperty({ type: 'integer' }) + [IntegrityReportType.ChecksumFail]!: number; + @ApiProperty({ type: 'integer' }) + [IntegrityReportType.MissingFile]!: number; + @ApiProperty({ type: 'integer' }) + [IntegrityReportType.OrphanFile]!: number; +} + +export class IntegrityGetReportDto { + @ValidateEnum({ enum: IntegrityReportType, name: 'IntegrityReportType' }) + type!: IntegrityReportType; + + // todo: paginate + // @IsInt() + // @Min(1) + // @Type(() => Number) + // @Optional() + // page?: number; +} + +export class IntegrityDeleteReportDto { + @ValidateEnum({ enum: IntegrityReportType, name: 'IntegrityReportType' }) + type!: IntegrityReportType; +} + +class IntegrityReportDto { + id!: string; + @ValidateEnum({ enum: IntegrityReportType, name: 'IntegrityReportType' }) + type!: IntegrityReportType; + path!: string; +} + +export class IntegrityReportResponseDto { + items!: IntegrityReportDto[]; +} diff --git a/server/src/dtos/maintenance.dto.ts b/server/src/dtos/maintenance.dto.ts index e76a40dd9b..fe6960c0a4 100644 --- a/server/src/dtos/maintenance.dto.ts +++ b/server/src/dtos/maintenance.dto.ts @@ -1,5 +1,4 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { IntegrityReportType, MaintenanceAction } from 'src/enum'; +import { MaintenanceAction } from 'src/enum'; import { ValidateEnum, ValidateString } from 'src/validation'; export class SetMaintenanceModeDto { @@ -15,40 +14,3 @@ export class MaintenanceLoginDto { export class MaintenanceAuthDto { username!: string; } - -export class MaintenanceIntegrityReportSummaryResponseDto { - @ApiProperty({ type: 'integer' }) - [IntegrityReportType.ChecksumFail]!: number; - @ApiProperty({ type: 'integer' }) - [IntegrityReportType.MissingFile]!: number; - @ApiProperty({ type: 'integer' }) - [IntegrityReportType.OrphanFile]!: number; -} - -export class MaintenanceGetIntegrityReportDto { - @ValidateEnum({ enum: IntegrityReportType, name: 'IntegrityReportType' }) - type!: IntegrityReportType; - - // todo: paginate - // @IsInt() - // @Min(1) - // @Type(() => Number) - // @Optional() - // page?: number; -} - -export class MaintenanceDeleteIntegrityReportDto { - @ValidateEnum({ enum: IntegrityReportType, name: 'IntegrityReportType' }) - type!: IntegrityReportType; -} - -class MaintenanceIntegrityReportDto { - id!: string; - @ValidateEnum({ enum: IntegrityReportType, name: 'IntegrityReportType' }) - type!: IntegrityReportType; - path!: string; -} - -export class MaintenanceIntegrityReportResponseDto { - items!: MaintenanceIntegrityReportDto[]; -} diff --git a/server/src/services/integrity.service.spec.ts b/server/src/services/integrity.service.spec.ts index 3c7505074b..7266928565 100644 --- a/server/src/services/integrity.service.spec.ts +++ b/server/src/services/integrity.service.spec.ts @@ -3,6 +3,8 @@ import { newTestService, ServiceMocks } from 'test/utils'; describe(IntegrityService.name, () => { let sut: IntegrityService; + // impl. pending + // eslint-disable-next-line @typescript-eslint/no-unused-vars let mocks: ServiceMocks; beforeEach(() => { diff --git a/server/src/services/integrity.service.ts b/server/src/services/integrity.service.ts index 64832d0fcc..56d360ac2f 100644 --- a/server/src/services/integrity.service.ts +++ b/server/src/services/integrity.service.ts @@ -10,10 +10,10 @@ import { StorageCore } from 'src/cores/storage.core'; import { OnEvent, OnJob } from 'src/decorators'; import { AuthDto } from 'src/dtos/auth.dto'; import { - MaintenanceGetIntegrityReportDto, - MaintenanceIntegrityReportResponseDto, - MaintenanceIntegrityReportSummaryResponseDto, -} from 'src/dtos/maintenance.dto'; + IntegrityGetReportDto, + IntegrityReportResponseDto, + IntegrityReportSummaryResponseDto, +} from 'src/dtos/integrity.dto'; import { AssetStatus, CacheControl, @@ -154,11 +154,11 @@ export class IntegrityService extends BaseService { }); } - getIntegrityReportSummary(): Promise { + getIntegrityReportSummary(): Promise { return this.integrityRepository.getIntegrityReportSummary(); } - async getIntegrityReport(dto: MaintenanceGetIntegrityReportDto): Promise { + async getIntegrityReport(dto: IntegrityGetReportDto): Promise { return { items: await this.integrityRepository.getIntegrityReports(dto.type), };