Skip to content

Commit

Permalink
Update models to work with new keys
Browse files Browse the repository at this point in the history
creation_date was renamed to created and
update_date to last_updated
  • Loading branch information
rolandgeider committed Aug 8, 2023
1 parent f74a343 commit aecbcfe
Show file tree
Hide file tree
Showing 54 changed files with 527 additions and 285 deletions.
6 changes: 3 additions & 3 deletions integration_test/5_nutritional_plan.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Widget createNutritionalPlanScreen({locale = 'en'}) {
id: 1,
code: '123456787',
name: 'Müsli',
creationDate: DateTime(2021, 5, 1),
created: DateTime(2021, 5, 1),
energy: 500,
carbohydrates: 10,
carbohydratesSugar: 2,
Expand All @@ -36,7 +36,7 @@ Widget createNutritionalPlanScreen({locale = 'en'}) {
id: 1,
code: '123456787',
name: 'Milk',
creationDate: DateTime(2021, 5, 1),
created: DateTime(2021, 5, 1),
energy: 500,
carbohydrates: 10,
carbohydratesSugar: 2,
Expand All @@ -50,7 +50,7 @@ Widget createNutritionalPlanScreen({locale = 'en'}) {
id: 1,
code: '123456787',
name: 'Apple',
creationDate: DateTime(2021, 5, 1),
created: DateTime(2021, 5, 1),
energy: 500,
carbohydrates: 10,
carbohydratesSugar: 2,
Expand Down
3 changes: 2 additions & 1 deletion lib/models/body_weight/weight_entry.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions lib/models/exercises/base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class ExerciseBase extends Equatable {
@JsonKey(required: true, name: 'variations')
final int? variationId;

@JsonKey(required: true, name: 'creation_date')
final DateTime? creationDate;
@JsonKey(required: true, name: 'created')
final DateTime? created;

@JsonKey(required: true, name: 'update_date')
final DateTime? updateDate;
@JsonKey(required: true, name: 'last_update')
final DateTime? lastUpdate;

@JsonKey(required: true, name: 'category')
late int categoryId;
Expand Down Expand Up @@ -81,8 +81,8 @@ class ExerciseBase extends Equatable {
ExerciseBase({
this.id,
this.uuid,
this.creationDate,
this.updateDate,
this.created,
this.lastUpdate,
this.variationId,
List<Muscle>? muscles,
List<Muscle>? musclesSecondary,
Expand Down Expand Up @@ -115,7 +115,7 @@ class ExerciseBase extends Equatable {
}

if (exercises != null) {
this.translations = exercises;
translations = exercises;
}

if (videos != null) {
Expand Down Expand Up @@ -166,8 +166,8 @@ class ExerciseBase extends Equatable {
List<Object?> get props => [
id,
uuid,
creationDate,
updateDate,
created,
lastUpdate,
category,
equipment,
muscles,
Expand Down
31 changes: 19 additions & 12 deletions lib/models/exercises/base.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/models/exercises/category.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/models/exercises/image.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions lib/models/exercises/translation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class Translation extends Equatable {
@JsonKey(includeFromJson: false, includeToJson: false)
late Language languageObj;

@JsonKey(required: true, name: 'creation_date')
final DateTime? creationDate;
@JsonKey(required: true, name: 'created')
final DateTime? created;

@JsonKey(required: true, name: 'exercise_base')
late int? baseId;
Expand All @@ -60,7 +60,7 @@ class Translation extends Equatable {
Translation({
this.id,
this.uuid,
this.creationDate,
this.created,
required this.name,
required this.description,
int? baseId,
Expand Down Expand Up @@ -96,7 +96,7 @@ class Translation extends Equatable {
baseId,
uuid,
languageId,
creationDate,
created,
name,
description,
];
Expand Down
12 changes: 7 additions & 5 deletions lib/models/exercises/translation.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion lib/models/measurements/measurement_category.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/models/measurements/measurement_entry.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/models/nutrition/image.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions lib/models/nutrition/ingredient.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class Ingredient {
@JsonKey(required: true)
final String name;

@JsonKey(required: true, name: 'creation_date')
final DateTime creationDate;
@JsonKey(required: true, name: 'created')
final DateTime created;

/// Energy in kJ per 100g of product
@JsonKey(required: true)
Expand Down Expand Up @@ -75,7 +75,7 @@ class Ingredient {
required this.id,
required this.code,
required this.name,
required this.creationDate,
required this.created,
required this.energy,
required this.carbohydrates,
required this.carbohydratesSugar,
Expand All @@ -89,5 +89,6 @@ class Ingredient {

// Boilerplate
factory Ingredient.fromJson(Map<String, dynamic> json) => _$IngredientFromJson(json);

Map<String, dynamic> toJson() => _$IngredientToJson(this);
}
9 changes: 5 additions & 4 deletions lib/models/nutrition/ingredient.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions lib/models/nutrition/ingredient_weight_unit.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion lib/models/nutrition/log.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/models/nutrition/nutritional_plan.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/models/nutrition/weight_unit.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion lib/models/user/profile.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/models/workouts/repetition_unit.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit aecbcfe

Please sign in to comment.