Browse Source

Added explicit type for job count

Alex Tran 2 years ago
parent
commit
471a60dcb0

+ 5 - 5
mobile/openapi/doc/JobCounts.md

@@ -8,11 +8,11 @@ import 'package:openapi/api.dart';
 ## Properties
 Name | Type | Description | Notes
 ------------ | ------------- | ------------- | -------------
-**active** | **num** |  | 
-**completed** | **num** |  | 
-**failed** | **num** |  | 
-**delayed** | **num** |  | 
-**waiting** | **num** |  | 
+**active** | **int** |  | 
+**completed** | **int** |  | 
+**failed** | **int** |  | 
+**delayed** | **int** |  | 
+**waiting** | **int** |  | 
 
 [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
 

+ 10 - 20
mobile/openapi/lib/model/job_counts.dart

@@ -20,15 +20,15 @@ class JobCounts {
     required this.waiting,
   });
 
-  num active;
+  int active;
 
-  num completed;
+  int completed;
 
-  num failed;
+  int failed;
 
-  num delayed;
+  int delayed;
 
-  num waiting;
+  int waiting;
 
   @override
   bool operator ==(Object other) => identical(this, other) || other is JobCounts &&
@@ -79,21 +79,11 @@ class JobCounts {
       }());
 
       return JobCounts(
-        active: json[r'active'] == null
-            ? null
-            : num.parse(json[r'active'].toString()),
-        completed: json[r'completed'] == null
-            ? null
-            : num.parse(json[r'completed'].toString()),
-        failed: json[r'failed'] == null
-            ? null
-            : num.parse(json[r'failed'].toString()),
-        delayed: json[r'delayed'] == null
-            ? null
-            : num.parse(json[r'delayed'].toString()),
-        waiting: json[r'waiting'] == null
-            ? null
-            : num.parse(json[r'waiting'].toString()),
+        active: mapValueOfType<int>(json, r'active')!,
+        completed: mapValueOfType<int>(json, r'completed')!,
+        failed: mapValueOfType<int>(json, r'failed')!,
+        delayed: mapValueOfType<int>(json, r'delayed')!,
+        waiting: mapValueOfType<int>(json, r'waiting')!,
       );
     }
     return null;

+ 5 - 0
server/apps/immich/src/api-v1/job/response-dto/all-job-status-response.dto.ts

@@ -1,10 +1,15 @@
 import { ApiProperty } from '@nestjs/swagger';
 
 export class JobCounts {
+  @ApiProperty({ type: 'integer' })
   active!: number;
+  @ApiProperty({ type: 'integer' })
   completed!: number;
+  @ApiProperty({ type: 'integer' })
   failed!: number;
+  @ApiProperty({ type: 'integer' })
   delayed!: number;
+  @ApiProperty({ type: 'integer' })
   waiting!: number;
 }
 export class AllJobStatusResponseDto {

File diff suppressed because it is too large
+ 0 - 0
server/immich-openapi-specs.json


Some files were not shown because too many files changed in this diff