Skip to content

Commit

Permalink
Added explicit type for job count
Browse files Browse the repository at this point in the history
  • Loading branch information
alextran1502 committed Oct 6, 2022
1 parent 46994c3 commit 471a60d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 26 deletions.
10 changes: 5 additions & 5 deletions mobile/openapi/doc/JobCounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
30 changes: 10 additions & 20 deletions mobile/openapi/lib/model/job_counts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Loading

0 comments on commit 471a60d

Please sign in to comment.