mirror of
https://github.com/immich-app/immich.git
synced 2025-12-19 17:23:21 +03:00
refactor: split maintenance dto for integrity checks
This commit is contained in:
8
mobile/openapi/README.md
generated
8
mobile/openapi/README.md
generated
@@ -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)
|
||||
|
||||
8
mobile/openapi/lib/api.dart
generated
8
mobile/openapi/lib/api.dart
generated
@@ -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';
|
||||
|
||||
18
mobile/openapi/lib/api/maintenance_admin_api.dart
generated
18
mobile/openapi/lib/api/maintenance_admin_api.dart
generated
@@ -73,13 +73,13 @@ class MaintenanceAdminApi {
|
||||
///
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [MaintenanceGetIntegrityReportDto] maintenanceGetIntegrityReportDto (required):
|
||||
Future<Response> getIntegrityReportWithHttpInfo(MaintenanceGetIntegrityReportDto maintenanceGetIntegrityReportDto,) async {
|
||||
/// * [IntegrityGetReportDto] integrityGetReportDto (required):
|
||||
Future<Response> 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 = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
@@ -105,9 +105,9 @@ class MaintenanceAdminApi {
|
||||
///
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [MaintenanceGetIntegrityReportDto] maintenanceGetIntegrityReportDto (required):
|
||||
Future<MaintenanceIntegrityReportResponseDto?> getIntegrityReport(MaintenanceGetIntegrityReportDto maintenanceGetIntegrityReportDto,) async {
|
||||
final response = await getIntegrityReportWithHttpInfo(maintenanceGetIntegrityReportDto,);
|
||||
/// * [IntegrityGetReportDto] integrityGetReportDto (required):
|
||||
Future<IntegrityReportResponseDto?> 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<MaintenanceIntegrityReportSummaryResponseDto?> getIntegrityReportSummary() async {
|
||||
Future<IntegrityReportSummaryResponseDto?> 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;
|
||||
|
||||
16
mobile/openapi/lib/api_client.dart
generated
16
mobile/openapi/lib/api_client.dart
generated
@@ -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':
|
||||
|
||||
@@ -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<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@@ -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<String, dynamic>();
|
||||
|
||||
return MaintenanceGetIntegrityReportDto(
|
||||
return IntegrityGetReportDto(
|
||||
type: IntegrityReportType.fromJson(json[r'type'])!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<MaintenanceGetIntegrityReportDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <MaintenanceGetIntegrityReportDto>[];
|
||||
static List<IntegrityGetReportDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <IntegrityGetReportDto>[];
|
||||
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<String, MaintenanceGetIntegrityReportDto> mapFromJson(dynamic json) {
|
||||
final map = <String, MaintenanceGetIntegrityReportDto>{};
|
||||
static Map<String, IntegrityGetReportDto> mapFromJson(dynamic json) {
|
||||
final map = <String, IntegrityGetReportDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // 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<String, List<MaintenanceGetIntegrityReportDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<MaintenanceGetIntegrityReportDto>>{};
|
||||
// maps a json object with a list of IntegrityGetReportDto-objects as value to a dart map
|
||||
static Map<String, List<IntegrityGetReportDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<IntegrityGetReportDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
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;
|
||||
@@ -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<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@@ -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<String, dynamic>();
|
||||
|
||||
return MaintenanceIntegrityReportDto(
|
||||
return IntegrityReportDto(
|
||||
id: mapValueOfType<String>(json, r'id')!,
|
||||
path: mapValueOfType<String>(json, r'path')!,
|
||||
type: IntegrityReportType.fromJson(json[r'type'])!,
|
||||
@@ -65,11 +65,11 @@ class MaintenanceIntegrityReportDto {
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<MaintenanceIntegrityReportDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <MaintenanceIntegrityReportDto>[];
|
||||
static List<IntegrityReportDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <IntegrityReportDto>[];
|
||||
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<String, MaintenanceIntegrityReportDto> mapFromJson(dynamic json) {
|
||||
final map = <String, MaintenanceIntegrityReportDto>{};
|
||||
static Map<String, IntegrityReportDto> mapFromJson(dynamic json) {
|
||||
final map = <String, IntegrityReportDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // 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<String, List<MaintenanceIntegrityReportDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<MaintenanceIntegrityReportDto>>{};
|
||||
// maps a json object with a list of IntegrityReportDto-objects as value to a dart map
|
||||
static Map<String, List<IntegrityReportDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<IntegrityReportDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
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;
|
||||
@@ -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<MaintenanceIntegrityReportDto> items;
|
||||
List<IntegrityReportDto> 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<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@@ -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<String, dynamic>();
|
||||
|
||||
return MaintenanceIntegrityReportResponseDto(
|
||||
items: MaintenanceIntegrityReportDto.listFromJson(json[r'items']),
|
||||
return IntegrityReportResponseDto(
|
||||
items: IntegrityReportDto.listFromJson(json[r'items']),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<MaintenanceIntegrityReportResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <MaintenanceIntegrityReportResponseDto>[];
|
||||
static List<IntegrityReportResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <IntegrityReportResponseDto>[];
|
||||
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<String, MaintenanceIntegrityReportResponseDto> mapFromJson(dynamic json) {
|
||||
final map = <String, MaintenanceIntegrityReportResponseDto>{};
|
||||
static Map<String, IntegrityReportResponseDto> mapFromJson(dynamic json) {
|
||||
final map = <String, IntegrityReportResponseDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // 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<String, List<MaintenanceIntegrityReportResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<MaintenanceIntegrityReportResponseDto>>{};
|
||||
// maps a json object with a list of IntegrityReportResponseDto-objects as value to a dart map
|
||||
static Map<String, List<IntegrityReportResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<IntegrityReportResponseDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
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;
|
||||
@@ -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<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@@ -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<String, dynamic>();
|
||||
|
||||
return MaintenanceIntegrityReportSummaryResponseDto(
|
||||
return IntegrityReportSummaryResponseDto(
|
||||
checksumMismatch: mapValueOfType<int>(json, r'checksum_mismatch')!,
|
||||
missingFile: mapValueOfType<int>(json, r'missing_file')!,
|
||||
orphanFile: mapValueOfType<int>(json, r'orphan_file')!,
|
||||
@@ -65,11 +65,11 @@ class MaintenanceIntegrityReportSummaryResponseDto {
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<MaintenanceIntegrityReportSummaryResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <MaintenanceIntegrityReportSummaryResponseDto>[];
|
||||
static List<IntegrityReportSummaryResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <IntegrityReportSummaryResponseDto>[];
|
||||
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<String, MaintenanceIntegrityReportSummaryResponseDto> mapFromJson(dynamic json) {
|
||||
final map = <String, MaintenanceIntegrityReportSummaryResponseDto>{};
|
||||
static Map<String, IntegrityReportSummaryResponseDto> mapFromJson(dynamic json) {
|
||||
final map = <String, IntegrityReportSummaryResponseDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // 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<String, List<MaintenanceIntegrityReportSummaryResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<MaintenanceIntegrityReportSummaryResponseDto>>{};
|
||||
// maps a json object with a list of IntegrityReportSummaryResponseDto-objects as value to a dart map
|
||||
static Map<String, List<IntegrityReportSummaryResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<IntegrityReportSummaryResponseDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
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;
|
||||
@@ -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": {
|
||||
|
||||
@@ -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
|
||||
}));
|
||||
|
||||
@@ -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<MaintenanceIntegrityReportSummaryResponseDto> {
|
||||
getIntegrityReportSummary(): Promise<IntegrityReportSummaryResponseDto> {
|
||||
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<MaintenanceIntegrityReportResponseDto> {
|
||||
getIntegrityReport(@Body() dto: IntegrityGetReportDto): Promise<IntegrityReportResponseDto> {
|
||||
return this.service.getIntegrityReport(dto);
|
||||
}
|
||||
|
||||
|
||||
40
server/src/dtos/integrity.dto.ts
Normal file
40
server/src/dtos/integrity.dto.ts
Normal 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[];
|
||||
}
|
||||
@@ -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[];
|
||||
}
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
@@ -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<MaintenanceIntegrityReportSummaryResponseDto> {
|
||||
getIntegrityReportSummary(): Promise<IntegrityReportSummaryResponseDto> {
|
||||
return this.integrityRepository.getIntegrityReportSummary();
|
||||
}
|
||||
|
||||
async getIntegrityReport(dto: MaintenanceGetIntegrityReportDto): Promise<MaintenanceIntegrityReportResponseDto> {
|
||||
async getIntegrityReport(dto: IntegrityGetReportDto): Promise<IntegrityReportResponseDto> {
|
||||
return {
|
||||
items: await this.integrityRepository.getIntegrityReports(dto.type),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user