-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
Implement phases section
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ on: | |
push: | ||
branches: | ||
- master | ||
- develop | ||
jobs: | ||
UpdateJsons: | ||
runs-on: ubuntu-latest | ||
|
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (C) 2020 covid19cuba | ||
// Use of this source code is governed by a GNU GPL 3 license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:covid19cuba/src/data_providers/data_providers.dart'; | ||
import 'package:covid19cuba/src/models/phases/phases.dart'; | ||
import 'package:covid19cuba/src/models/phases/phases_state.dart'; | ||
import 'package:covid19cuba/src/utils/utils.dart'; | ||
|
||
class PhasesProvider extends DataProvider<Phases, PhasesState> { | ||
@override | ||
String get urlDataCU => | ||
'https://cusobu.nat.cu/covid/api/v2/phases.json'; | ||
|
||
@override | ||
String get urlDataIO => | ||
'https://covid19cuba.github.io/covid19cubadata.github.io/api/v2/phases.json'; | ||
|
||
@override | ||
String get urlDataStateCU => | ||
'https://cusobu.nat.cu/covid/api/v2/phases_state.json'; | ||
|
||
@override | ||
String get urlDataStateIO => | ||
'https://covid19cuba.github.io/covid19cubadata.github.io/api/v2/phases_state.json'; | ||
|
||
@override | ||
String get prefData => Constants.prefPhases; | ||
|
||
@override | ||
String get prefHash => Constants.prefPhasesState; | ||
|
||
@override | ||
Phases dataFromJson(Map<String, dynamic> data) => | ||
Phases.fromJson(data); | ||
|
||
@override | ||
PhasesState dataStateFromJson(Map<String, dynamic> data) => | ||
PhasesState.fromJson(data); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (C) 2020 covid19cuba | ||
// Use of this source code is governed by a GNU GPL 3 license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:covid19cuba/src/models/model.dart'; | ||
import 'package:covid19cuba/src/models/phases/phases_category.dart'; | ||
import 'package:covid19cuba/src/models/phases/phases_item.dart'; | ||
import 'package:covid19cuba/src/models/phases/phases_measure.dart'; | ||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
part 'phases.g.dart'; | ||
|
||
@JsonSerializable() | ||
class Phases extends Model { | ||
List<PhasesItem> phases; | ||
Map<String, PhasesCategory> categories; | ||
Map<String, PhasesMeasure> measures; | ||
|
||
Phases(); | ||
|
||
factory Phases.fromJson(Map<String, dynamic> json) => _$PhasesFromJson(json); | ||
|
||
Map<String, dynamic> toJson() => _$PhasesToJson(this); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (C) 2020 covid19cuba | ||
// Use of this source code is governed by a GNU GPL 3 license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
part 'phases_category.g.dart'; | ||
|
||
@JsonSerializable() | ||
class PhasesCategory { | ||
String name; | ||
@JsonKey(required: false) | ||
String parent; | ||
|
||
PhasesCategory(); | ||
|
||
factory PhasesCategory.fromJson(Map<String, dynamic> json) => | ||
_$PhasesCategoryFromJson(json); | ||
|
||
Map<String, dynamic> toJson() => _$PhasesCategoryToJson(this); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (C) 2020 covid19cuba | ||
// Use of this source code is governed by a GNU GPL 3 license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
part 'phases_item.g.dart'; | ||
|
||
@JsonSerializable() | ||
class PhasesItem { | ||
int order; | ||
String name; | ||
List<String> provinces; | ||
List<String> measures; | ||
|
||
PhasesItem(); | ||
|
||
factory PhasesItem.fromJson(Map<String, dynamic> json) => | ||
_$PhasesItemFromJson(json); | ||
|
||
Map<String, dynamic> toJson() => _$PhasesItemToJson(this); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (C) 2020 covid19cuba | ||
// Use of this source code is governed by a GNU GPL 3 license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
part 'phases_measure.g.dart'; | ||
|
||
@JsonSerializable() | ||
class PhasesMeasure { | ||
String text; | ||
String category; | ||
List<int> phases; | ||
|
||
PhasesMeasure(); | ||
|
||
factory PhasesMeasure.fromJson(Map<String, dynamic> json) => | ||
_$PhasesMeasureFromJson(json); | ||
|
||
Map<String, dynamic> toJson() => _$PhasesMeasureToJson(this); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (C) 2020 covid19cuba | ||
// Use of this source code is governed by a GNU GPL 3 license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:covid19cuba/src/models/model.dart'; | ||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
part 'phases_state.g.dart'; | ||
|
||
@JsonSerializable() | ||
class PhasesState extends CacheModel { | ||
PhasesState(); | ||
|
||
factory PhasesState.fromJson(Map<String, dynamic> json) => | ||
_$PhasesStateFromJson(json); | ||
|
||
Map<String, dynamic> toJson() => _$PhasesStateToJson(this); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.