refactor: split maintenance dto for integrity checks

This commit is contained in:
izzy
2025-12-17 15:04:45 +00:00
parent 21c26dd65f
commit 08e532170f
15 changed files with 242 additions and 238 deletions

View File

@@ -407,6 +407,10 @@ Class | Method | HTTP request | Description
- [FoldersResponse](doc//FoldersResponse.md) - [FoldersResponse](doc//FoldersResponse.md)
- [FoldersUpdate](doc//FoldersUpdate.md) - [FoldersUpdate](doc//FoldersUpdate.md)
- [ImageFormat](doc//ImageFormat.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) - [IntegrityReportType](doc//IntegrityReportType.md)
- [JobCreateDto](doc//JobCreateDto.md) - [JobCreateDto](doc//JobCreateDto.md)
- [JobName](doc//JobName.md) - [JobName](doc//JobName.md)
@@ -422,10 +426,6 @@ Class | Method | HTTP request | Description
- [MachineLearningAvailabilityChecksDto](doc//MachineLearningAvailabilityChecksDto.md) - [MachineLearningAvailabilityChecksDto](doc//MachineLearningAvailabilityChecksDto.md)
- [MaintenanceAction](doc//MaintenanceAction.md) - [MaintenanceAction](doc//MaintenanceAction.md)
- [MaintenanceAuthDto](doc//MaintenanceAuthDto.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) - [MaintenanceLoginDto](doc//MaintenanceLoginDto.md)
- [ManualJobName](doc//ManualJobName.md) - [ManualJobName](doc//ManualJobName.md)
- [MapMarkerResponseDto](doc//MapMarkerResponseDto.md) - [MapMarkerResponseDto](doc//MapMarkerResponseDto.md)

View File

@@ -154,6 +154,10 @@ part 'model/facial_recognition_config.dart';
part 'model/folders_response.dart'; part 'model/folders_response.dart';
part 'model/folders_update.dart'; part 'model/folders_update.dart';
part 'model/image_format.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/integrity_report_type.dart';
part 'model/job_create_dto.dart'; part 'model/job_create_dto.dart';
part 'model/job_name.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/machine_learning_availability_checks_dto.dart';
part 'model/maintenance_action.dart'; part 'model/maintenance_action.dart';
part 'model/maintenance_auth_dto.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/maintenance_login_dto.dart';
part 'model/manual_job_name.dart'; part 'model/manual_job_name.dart';
part 'model/map_marker_response_dto.dart'; part 'model/map_marker_response_dto.dart';

View File

@@ -73,13 +73,13 @@ class MaintenanceAdminApi {
/// ///
/// Parameters: /// Parameters:
/// ///
/// * [MaintenanceGetIntegrityReportDto] maintenanceGetIntegrityReportDto (required): /// * [IntegrityGetReportDto] integrityGetReportDto (required):
Future<Response> getIntegrityReportWithHttpInfo(MaintenanceGetIntegrityReportDto maintenanceGetIntegrityReportDto,) async { Future<Response> getIntegrityReportWithHttpInfo(IntegrityGetReportDto integrityGetReportDto,) async {
// ignore: prefer_const_declarations // ignore: prefer_const_declarations
final apiPath = r'/admin/integrity/report'; final apiPath = r'/admin/integrity/report';
// ignore: prefer_final_locals // ignore: prefer_final_locals
Object? postBody = maintenanceGetIntegrityReportDto; Object? postBody = integrityGetReportDto;
final queryParams = <QueryParam>[]; final queryParams = <QueryParam>[];
final headerParams = <String, String>{}; final headerParams = <String, String>{};
@@ -105,9 +105,9 @@ class MaintenanceAdminApi {
/// ///
/// Parameters: /// Parameters:
/// ///
/// * [MaintenanceGetIntegrityReportDto] maintenanceGetIntegrityReportDto (required): /// * [IntegrityGetReportDto] integrityGetReportDto (required):
Future<MaintenanceIntegrityReportResponseDto?> getIntegrityReport(MaintenanceGetIntegrityReportDto maintenanceGetIntegrityReportDto,) async { Future<IntegrityReportResponseDto?> getIntegrityReport(IntegrityGetReportDto integrityGetReportDto,) async {
final response = await getIntegrityReportWithHttpInfo(maintenanceGetIntegrityReportDto,); final response = await getIntegrityReportWithHttpInfo(integrityGetReportDto,);
if (response.statusCode >= HttpStatus.badRequest) { if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response)); 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" // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string. // FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { 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; return null;
@@ -268,7 +268,7 @@ class MaintenanceAdminApi {
/// Get integrity report summary /// Get integrity report summary
/// ///
/// ... /// ...
Future<MaintenanceIntegrityReportSummaryResponseDto?> getIntegrityReportSummary() async { Future<IntegrityReportSummaryResponseDto?> getIntegrityReportSummary() async {
final response = await getIntegrityReportSummaryWithHttpInfo(); final response = await getIntegrityReportSummaryWithHttpInfo();
if (response.statusCode >= HttpStatus.badRequest) { if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response)); 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" // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string. // FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { 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; return null;

View File

@@ -356,6 +356,14 @@ class ApiClient {
return FoldersUpdate.fromJson(value); return FoldersUpdate.fromJson(value);
case 'ImageFormat': case 'ImageFormat':
return ImageFormatTypeTransformer().decode(value); 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': case 'IntegrityReportType':
return IntegrityReportTypeTypeTransformer().decode(value); return IntegrityReportTypeTypeTransformer().decode(value);
case 'JobCreateDto': case 'JobCreateDto':
@@ -386,14 +394,6 @@ class ApiClient {
return MaintenanceActionTypeTransformer().decode(value); return MaintenanceActionTypeTransformer().decode(value);
case 'MaintenanceAuthDto': case 'MaintenanceAuthDto':
return MaintenanceAuthDto.fromJson(value); 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': case 'MaintenanceLoginDto':
return MaintenanceLoginDto.fromJson(value); return MaintenanceLoginDto.fromJson(value);
case 'ManualJobName': case 'ManualJobName':

View File

@@ -10,16 +10,16 @@
part of openapi.api; part of openapi.api;
class MaintenanceGetIntegrityReportDto { class IntegrityGetReportDto {
/// Returns a new [MaintenanceGetIntegrityReportDto] instance. /// Returns a new [IntegrityGetReportDto] instance.
MaintenanceGetIntegrityReportDto({ IntegrityGetReportDto({
required this.type, required this.type,
}); });
IntegrityReportType type; IntegrityReportType type;
@override @override
bool operator ==(Object other) => identical(this, other) || other is MaintenanceGetIntegrityReportDto && bool operator ==(Object other) => identical(this, other) || other is IntegrityGetReportDto &&
other.type == type; other.type == type;
@override @override
@@ -28,7 +28,7 @@ class MaintenanceGetIntegrityReportDto {
(type.hashCode); (type.hashCode);
@override @override
String toString() => 'MaintenanceGetIntegrityReportDto[type=$type]'; String toString() => 'IntegrityGetReportDto[type=$type]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@@ -36,26 +36,26 @@ class MaintenanceGetIntegrityReportDto {
return json; 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. /// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods // ignore: prefer_constructors_over_static_methods
static MaintenanceGetIntegrityReportDto? fromJson(dynamic value) { static IntegrityGetReportDto? fromJson(dynamic value) {
upgradeDto(value, "MaintenanceGetIntegrityReportDto"); upgradeDto(value, "IntegrityGetReportDto");
if (value is Map) { if (value is Map) {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return MaintenanceGetIntegrityReportDto( return IntegrityGetReportDto(
type: IntegrityReportType.fromJson(json[r'type'])!, type: IntegrityReportType.fromJson(json[r'type'])!,
); );
} }
return null; return null;
} }
static List<MaintenanceGetIntegrityReportDto> listFromJson(dynamic json, {bool growable = false,}) { static List<IntegrityGetReportDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <MaintenanceGetIntegrityReportDto>[]; final result = <IntegrityGetReportDto>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
final value = MaintenanceGetIntegrityReportDto.fromJson(row); final value = IntegrityGetReportDto.fromJson(row);
if (value != null) { if (value != null) {
result.add(value); result.add(value);
} }
@@ -64,12 +64,12 @@ class MaintenanceGetIntegrityReportDto {
return result.toList(growable: growable); return result.toList(growable: growable);
} }
static Map<String, MaintenanceGetIntegrityReportDto> mapFromJson(dynamic json) { static Map<String, IntegrityGetReportDto> mapFromJson(dynamic json) {
final map = <String, MaintenanceGetIntegrityReportDto>{}; final map = <String, IntegrityGetReportDto>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) { for (final entry in json.entries) {
final value = MaintenanceGetIntegrityReportDto.fromJson(entry.value); final value = IntegrityGetReportDto.fromJson(entry.value);
if (value != null) { if (value != null) {
map[entry.key] = value; map[entry.key] = value;
} }
@@ -78,14 +78,14 @@ class MaintenanceGetIntegrityReportDto {
return map; return map;
} }
// maps a json object with a list of MaintenanceGetIntegrityReportDto-objects as value to a dart map // maps a json object with a list of IntegrityGetReportDto-objects as value to a dart map
static Map<String, List<MaintenanceGetIntegrityReportDto>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<IntegrityGetReportDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<MaintenanceGetIntegrityReportDto>>{}; final map = <String, List<IntegrityGetReportDto>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { 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; return map;

View File

@@ -10,9 +10,9 @@
part of openapi.api; part of openapi.api;
class MaintenanceIntegrityReportDto { class IntegrityReportDto {
/// Returns a new [MaintenanceIntegrityReportDto] instance. /// Returns a new [IntegrityReportDto] instance.
MaintenanceIntegrityReportDto({ IntegrityReportDto({
required this.id, required this.id,
required this.path, required this.path,
required this.type, required this.type,
@@ -25,7 +25,7 @@ class MaintenanceIntegrityReportDto {
IntegrityReportType type; IntegrityReportType type;
@override @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.id == id &&
other.path == path && other.path == path &&
other.type == type; other.type == type;
@@ -38,7 +38,7 @@ class MaintenanceIntegrityReportDto {
(type.hashCode); (type.hashCode);
@override @override
String toString() => 'MaintenanceIntegrityReportDto[id=$id, path=$path, type=$type]'; String toString() => 'IntegrityReportDto[id=$id, path=$path, type=$type]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@@ -48,15 +48,15 @@ class MaintenanceIntegrityReportDto {
return json; 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. /// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods // ignore: prefer_constructors_over_static_methods
static MaintenanceIntegrityReportDto? fromJson(dynamic value) { static IntegrityReportDto? fromJson(dynamic value) {
upgradeDto(value, "MaintenanceIntegrityReportDto"); upgradeDto(value, "IntegrityReportDto");
if (value is Map) { if (value is Map) {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return MaintenanceIntegrityReportDto( return IntegrityReportDto(
id: mapValueOfType<String>(json, r'id')!, id: mapValueOfType<String>(json, r'id')!,
path: mapValueOfType<String>(json, r'path')!, path: mapValueOfType<String>(json, r'path')!,
type: IntegrityReportType.fromJson(json[r'type'])!, type: IntegrityReportType.fromJson(json[r'type'])!,
@@ -65,11 +65,11 @@ class MaintenanceIntegrityReportDto {
return null; return null;
} }
static List<MaintenanceIntegrityReportDto> listFromJson(dynamic json, {bool growable = false,}) { static List<IntegrityReportDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <MaintenanceIntegrityReportDto>[]; final result = <IntegrityReportDto>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
final value = MaintenanceIntegrityReportDto.fromJson(row); final value = IntegrityReportDto.fromJson(row);
if (value != null) { if (value != null) {
result.add(value); result.add(value);
} }
@@ -78,12 +78,12 @@ class MaintenanceIntegrityReportDto {
return result.toList(growable: growable); return result.toList(growable: growable);
} }
static Map<String, MaintenanceIntegrityReportDto> mapFromJson(dynamic json) { static Map<String, IntegrityReportDto> mapFromJson(dynamic json) {
final map = <String, MaintenanceIntegrityReportDto>{}; final map = <String, IntegrityReportDto>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) { for (final entry in json.entries) {
final value = MaintenanceIntegrityReportDto.fromJson(entry.value); final value = IntegrityReportDto.fromJson(entry.value);
if (value != null) { if (value != null) {
map[entry.key] = value; map[entry.key] = value;
} }
@@ -92,14 +92,14 @@ class MaintenanceIntegrityReportDto {
return map; return map;
} }
// maps a json object with a list of MaintenanceIntegrityReportDto-objects as value to a dart map // maps a json object with a list of IntegrityReportDto-objects as value to a dart map
static Map<String, List<MaintenanceIntegrityReportDto>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<IntegrityReportDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<MaintenanceIntegrityReportDto>>{}; final map = <String, List<IntegrityReportDto>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { 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; return map;

View File

@@ -10,16 +10,16 @@
part of openapi.api; part of openapi.api;
class MaintenanceIntegrityReportResponseDto { class IntegrityReportResponseDto {
/// Returns a new [MaintenanceIntegrityReportResponseDto] instance. /// Returns a new [IntegrityReportResponseDto] instance.
MaintenanceIntegrityReportResponseDto({ IntegrityReportResponseDto({
this.items = const [], this.items = const [],
}); });
List<MaintenanceIntegrityReportDto> items; List<IntegrityReportDto> items;
@override @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); _deepEquality.equals(other.items, items);
@override @override
@@ -28,7 +28,7 @@ class MaintenanceIntegrityReportResponseDto {
(items.hashCode); (items.hashCode);
@override @override
String toString() => 'MaintenanceIntegrityReportResponseDto[items=$items]'; String toString() => 'IntegrityReportResponseDto[items=$items]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@@ -36,26 +36,26 @@ class MaintenanceIntegrityReportResponseDto {
return json; 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. /// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods // ignore: prefer_constructors_over_static_methods
static MaintenanceIntegrityReportResponseDto? fromJson(dynamic value) { static IntegrityReportResponseDto? fromJson(dynamic value) {
upgradeDto(value, "MaintenanceIntegrityReportResponseDto"); upgradeDto(value, "IntegrityReportResponseDto");
if (value is Map) { if (value is Map) {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return MaintenanceIntegrityReportResponseDto( return IntegrityReportResponseDto(
items: MaintenanceIntegrityReportDto.listFromJson(json[r'items']), items: IntegrityReportDto.listFromJson(json[r'items']),
); );
} }
return null; return null;
} }
static List<MaintenanceIntegrityReportResponseDto> listFromJson(dynamic json, {bool growable = false,}) { static List<IntegrityReportResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <MaintenanceIntegrityReportResponseDto>[]; final result = <IntegrityReportResponseDto>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
final value = MaintenanceIntegrityReportResponseDto.fromJson(row); final value = IntegrityReportResponseDto.fromJson(row);
if (value != null) { if (value != null) {
result.add(value); result.add(value);
} }
@@ -64,12 +64,12 @@ class MaintenanceIntegrityReportResponseDto {
return result.toList(growable: growable); return result.toList(growable: growable);
} }
static Map<String, MaintenanceIntegrityReportResponseDto> mapFromJson(dynamic json) { static Map<String, IntegrityReportResponseDto> mapFromJson(dynamic json) {
final map = <String, MaintenanceIntegrityReportResponseDto>{}; final map = <String, IntegrityReportResponseDto>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) { for (final entry in json.entries) {
final value = MaintenanceIntegrityReportResponseDto.fromJson(entry.value); final value = IntegrityReportResponseDto.fromJson(entry.value);
if (value != null) { if (value != null) {
map[entry.key] = value; map[entry.key] = value;
} }
@@ -78,14 +78,14 @@ class MaintenanceIntegrityReportResponseDto {
return map; return map;
} }
// maps a json object with a list of MaintenanceIntegrityReportResponseDto-objects as value to a dart map // maps a json object with a list of IntegrityReportResponseDto-objects as value to a dart map
static Map<String, List<MaintenanceIntegrityReportResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<IntegrityReportResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<MaintenanceIntegrityReportResponseDto>>{}; final map = <String, List<IntegrityReportResponseDto>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { 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; return map;

View File

@@ -10,9 +10,9 @@
part of openapi.api; part of openapi.api;
class MaintenanceIntegrityReportSummaryResponseDto { class IntegrityReportSummaryResponseDto {
/// Returns a new [MaintenanceIntegrityReportSummaryResponseDto] instance. /// Returns a new [IntegrityReportSummaryResponseDto] instance.
MaintenanceIntegrityReportSummaryResponseDto({ IntegrityReportSummaryResponseDto({
required this.checksumMismatch, required this.checksumMismatch,
required this.missingFile, required this.missingFile,
required this.orphanFile, required this.orphanFile,
@@ -25,7 +25,7 @@ class MaintenanceIntegrityReportSummaryResponseDto {
int orphanFile; int orphanFile;
@override @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.checksumMismatch == checksumMismatch &&
other.missingFile == missingFile && other.missingFile == missingFile &&
other.orphanFile == orphanFile; other.orphanFile == orphanFile;
@@ -38,7 +38,7 @@ class MaintenanceIntegrityReportSummaryResponseDto {
(orphanFile.hashCode); (orphanFile.hashCode);
@override @override
String toString() => 'MaintenanceIntegrityReportSummaryResponseDto[checksumMismatch=$checksumMismatch, missingFile=$missingFile, orphanFile=$orphanFile]'; String toString() => 'IntegrityReportSummaryResponseDto[checksumMismatch=$checksumMismatch, missingFile=$missingFile, orphanFile=$orphanFile]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@@ -48,15 +48,15 @@ class MaintenanceIntegrityReportSummaryResponseDto {
return json; 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. /// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods // ignore: prefer_constructors_over_static_methods
static MaintenanceIntegrityReportSummaryResponseDto? fromJson(dynamic value) { static IntegrityReportSummaryResponseDto? fromJson(dynamic value) {
upgradeDto(value, "MaintenanceIntegrityReportSummaryResponseDto"); upgradeDto(value, "IntegrityReportSummaryResponseDto");
if (value is Map) { if (value is Map) {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return MaintenanceIntegrityReportSummaryResponseDto( return IntegrityReportSummaryResponseDto(
checksumMismatch: mapValueOfType<int>(json, r'checksum_mismatch')!, checksumMismatch: mapValueOfType<int>(json, r'checksum_mismatch')!,
missingFile: mapValueOfType<int>(json, r'missing_file')!, missingFile: mapValueOfType<int>(json, r'missing_file')!,
orphanFile: mapValueOfType<int>(json, r'orphan_file')!, orphanFile: mapValueOfType<int>(json, r'orphan_file')!,
@@ -65,11 +65,11 @@ class MaintenanceIntegrityReportSummaryResponseDto {
return null; return null;
} }
static List<MaintenanceIntegrityReportSummaryResponseDto> listFromJson(dynamic json, {bool growable = false,}) { static List<IntegrityReportSummaryResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <MaintenanceIntegrityReportSummaryResponseDto>[]; final result = <IntegrityReportSummaryResponseDto>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
final value = MaintenanceIntegrityReportSummaryResponseDto.fromJson(row); final value = IntegrityReportSummaryResponseDto.fromJson(row);
if (value != null) { if (value != null) {
result.add(value); result.add(value);
} }
@@ -78,12 +78,12 @@ class MaintenanceIntegrityReportSummaryResponseDto {
return result.toList(growable: growable); return result.toList(growable: growable);
} }
static Map<String, MaintenanceIntegrityReportSummaryResponseDto> mapFromJson(dynamic json) { static Map<String, IntegrityReportSummaryResponseDto> mapFromJson(dynamic json) {
final map = <String, MaintenanceIntegrityReportSummaryResponseDto>{}; final map = <String, IntegrityReportSummaryResponseDto>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) { for (final entry in json.entries) {
final value = MaintenanceIntegrityReportSummaryResponseDto.fromJson(entry.value); final value = IntegrityReportSummaryResponseDto.fromJson(entry.value);
if (value != null) { if (value != null) {
map[entry.key] = value; map[entry.key] = value;
} }
@@ -92,14 +92,14 @@ class MaintenanceIntegrityReportSummaryResponseDto {
return map; return map;
} }
// maps a json object with a list of MaintenanceIntegrityReportSummaryResponseDto-objects as value to a dart map // maps a json object with a list of IntegrityReportSummaryResponseDto-objects as value to a dart map
static Map<String, List<MaintenanceIntegrityReportSummaryResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<IntegrityReportSummaryResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<MaintenanceIntegrityReportSummaryResponseDto>>{}; final map = <String, List<IntegrityReportSummaryResponseDto>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { 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; return map;

View File

@@ -331,7 +331,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/MaintenanceGetIntegrityReportDto" "$ref": "#/components/schemas/IntegrityGetReportDto"
} }
} }
}, },
@@ -342,7 +342,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/MaintenanceIntegrityReportResponseDto" "$ref": "#/components/schemas/IntegrityReportResponseDto"
} }
} }
}, },
@@ -554,7 +554,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/MaintenanceIntegrityReportSummaryResponseDto" "$ref": "#/components/schemas/IntegrityReportSummaryResponseDto"
} }
} }
}, },
@@ -16862,6 +16862,77 @@
], ],
"type": "string" "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": { "IntegrityReportType": {
"enum": [ "enum": [
"orphan_file", "orphan_file",
@@ -17204,77 +17275,6 @@
], ],
"type": "object" "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": { "MaintenanceLoginDto": {
"properties": { "properties": {
"token": { "token": {

View File

@@ -40,18 +40,18 @@ export type ActivityStatisticsResponseDto = {
comments: number; comments: number;
likes: number; likes: number;
}; };
export type MaintenanceGetIntegrityReportDto = { export type IntegrityGetReportDto = {
"type": IntegrityReportType; "type": IntegrityReportType;
}; };
export type MaintenanceIntegrityReportDto = { export type IntegrityReportDto = {
id: string; id: string;
path: string; path: string;
"type": IntegrityReportType; "type": IntegrityReportType;
}; };
export type MaintenanceIntegrityReportResponseDto = { export type IntegrityReportResponseDto = {
items: MaintenanceIntegrityReportDto[]; items: IntegrityReportDto[];
}; };
export type MaintenanceIntegrityReportSummaryResponseDto = { export type IntegrityReportSummaryResponseDto = {
checksum_mismatch: number; checksum_mismatch: number;
missing_file: number; missing_file: number;
orphan_file: number; orphan_file: number;
@@ -1887,16 +1887,16 @@ export function unlinkAllOAuthAccountsAdmin(opts?: Oazapfts.RequestOpts) {
/** /**
* Get integrity report by type * Get integrity report by type
*/ */
export function getIntegrityReport({ maintenanceGetIntegrityReportDto }: { export function getIntegrityReport({ integrityGetReportDto }: {
maintenanceGetIntegrityReportDto: MaintenanceGetIntegrityReportDto; integrityGetReportDto: IntegrityGetReportDto;
}, opts?: Oazapfts.RequestOpts) { }, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{ return oazapfts.ok(oazapfts.fetchJson<{
status: 201; status: 201;
data: MaintenanceIntegrityReportResponseDto; data: IntegrityReportResponseDto;
}>("/admin/integrity/report", oazapfts.json({ }>("/admin/integrity/report", oazapfts.json({
...opts, ...opts,
method: "POST", method: "POST",
body: maintenanceGetIntegrityReportDto body: integrityGetReportDto
}))); })));
} }
/** /**
@@ -1942,7 +1942,7 @@ export function getIntegrityReportCsv({ $type }: {
export function getIntegrityReportSummary(opts?: Oazapfts.RequestOpts) { export function getIntegrityReportSummary(opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{ return oazapfts.ok(oazapfts.fetchJson<{
status: 200; status: 200;
data: MaintenanceIntegrityReportSummaryResponseDto; data: IntegrityReportSummaryResponseDto;
}>("/admin/integrity/summary", { }>("/admin/integrity/summary", {
...opts ...opts
})); }));

View File

@@ -4,10 +4,10 @@ import { NextFunction, Response } from 'express';
import { Endpoint, HistoryBuilder } from 'src/decorators'; import { Endpoint, HistoryBuilder } from 'src/decorators';
import { AuthDto } from 'src/dtos/auth.dto'; import { AuthDto } from 'src/dtos/auth.dto';
import { import {
MaintenanceGetIntegrityReportDto, IntegrityGetReportDto,
MaintenanceIntegrityReportResponseDto, IntegrityReportResponseDto,
MaintenanceIntegrityReportSummaryResponseDto, IntegrityReportSummaryResponseDto,
} from 'src/dtos/maintenance.dto'; } from 'src/dtos/integrity.dto';
import { ApiTag, Permission } from 'src/enum'; import { ApiTag, Permission } from 'src/enum';
import { Auth, Authenticated, FileResponse } from 'src/middleware/auth.guard'; import { Auth, Authenticated, FileResponse } from 'src/middleware/auth.guard';
import { LoggingRepository } from 'src/repositories/logging.repository'; 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'), history: new HistoryBuilder().added('v9.9.9').alpha('v9.9.9'),
}) })
@Authenticated({ permission: Permission.Maintenance, admin: true }) @Authenticated({ permission: Permission.Maintenance, admin: true })
getIntegrityReportSummary(): Promise<MaintenanceIntegrityReportSummaryResponseDto> { getIntegrityReportSummary(): Promise<IntegrityReportSummaryResponseDto> {
return this.service.getIntegrityReportSummary(); return this.service.getIntegrityReportSummary();
} }
@@ -41,7 +41,7 @@ export class IntegrityController {
history: new HistoryBuilder().added('v9.9.9').alpha('v9.9.9'), history: new HistoryBuilder().added('v9.9.9').alpha('v9.9.9'),
}) })
@Authenticated({ permission: Permission.Maintenance, admin: true }) @Authenticated({ permission: Permission.Maintenance, admin: true })
getIntegrityReport(@Body() dto: MaintenanceGetIntegrityReportDto): Promise<MaintenanceIntegrityReportResponseDto> { getIntegrityReport(@Body() dto: IntegrityGetReportDto): Promise<IntegrityReportResponseDto> {
return this.service.getIntegrityReport(dto); return this.service.getIntegrityReport(dto);
} }

View File

@@ -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[];
}

View File

@@ -1,5 +1,4 @@
import { ApiProperty } from '@nestjs/swagger'; import { MaintenanceAction } from 'src/enum';
import { IntegrityReportType, MaintenanceAction } from 'src/enum';
import { ValidateEnum, ValidateString } from 'src/validation'; import { ValidateEnum, ValidateString } from 'src/validation';
export class SetMaintenanceModeDto { export class SetMaintenanceModeDto {
@@ -15,40 +14,3 @@ export class MaintenanceLoginDto {
export class MaintenanceAuthDto { export class MaintenanceAuthDto {
username!: string; 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[];
}

View File

@@ -3,6 +3,8 @@ import { newTestService, ServiceMocks } from 'test/utils';
describe(IntegrityService.name, () => { describe(IntegrityService.name, () => {
let sut: IntegrityService; let sut: IntegrityService;
// impl. pending
// eslint-disable-next-line @typescript-eslint/no-unused-vars
let mocks: ServiceMocks; let mocks: ServiceMocks;
beforeEach(() => { beforeEach(() => {

View File

@@ -10,10 +10,10 @@ import { StorageCore } from 'src/cores/storage.core';
import { OnEvent, OnJob } from 'src/decorators'; import { OnEvent, OnJob } from 'src/decorators';
import { AuthDto } from 'src/dtos/auth.dto'; import { AuthDto } from 'src/dtos/auth.dto';
import { import {
MaintenanceGetIntegrityReportDto, IntegrityGetReportDto,
MaintenanceIntegrityReportResponseDto, IntegrityReportResponseDto,
MaintenanceIntegrityReportSummaryResponseDto, IntegrityReportSummaryResponseDto,
} from 'src/dtos/maintenance.dto'; } from 'src/dtos/integrity.dto';
import { import {
AssetStatus, AssetStatus,
CacheControl, CacheControl,
@@ -154,11 +154,11 @@ export class IntegrityService extends BaseService {
}); });
} }
getIntegrityReportSummary(): Promise<MaintenanceIntegrityReportSummaryResponseDto> { getIntegrityReportSummary(): Promise<IntegrityReportSummaryResponseDto> {
return this.integrityRepository.getIntegrityReportSummary(); return this.integrityRepository.getIntegrityReportSummary();
} }
async getIntegrityReport(dto: MaintenanceGetIntegrityReportDto): Promise<MaintenanceIntegrityReportResponseDto> { async getIntegrityReport(dto: IntegrityGetReportDto): Promise<IntegrityReportResponseDto> {
return { return {
items: await this.integrityRepository.getIntegrityReports(dto.type), items: await this.integrityRepository.getIntegrityReports(dto.type),
}; };