forked from eatvio/eatvio_app
54 lines
1.7 KiB
Dart
54 lines
1.7 KiB
Dart
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
part 'recipes_model.freezed.dart';
|
|
part 'recipes_model.g.dart';
|
|
|
|
@freezed
|
|
class Recipes with _$Recipes {
|
|
const factory Recipes({
|
|
required int id,
|
|
required String image,
|
|
required String state,
|
|
@JsonKey(name: 'cooking_time') required int cookingTime,
|
|
required List<Ingredient> ingredients,
|
|
required String description,
|
|
required List<Step> steps,
|
|
@JsonKey(name: 'video_url') required String videoUrl,
|
|
@JsonKey(name: 'created_at') required DateTime createdAt,
|
|
@JsonKey(name: 'updated_at') required DateTime updatedAt,
|
|
required String title,
|
|
required String type,
|
|
required String slug,
|
|
@JsonKey(name: 'total_comments') required int commentsCount,
|
|
@JsonKey(name: 'was_liked_by_me') required bool wasLikedByMe,
|
|
@JsonKey(name: 'energy_per_serving') required double calories,
|
|
@JsonKey(name: 'total_likes') required int likesCount,
|
|
@JsonKey(name: 'total_views') required int viewsCount,
|
|
required Author author,
|
|
}) = _Recipes;
|
|
|
|
factory Recipes.fromJson(Map<String, Object?> json) => _$RecipesFromJson(json);
|
|
}
|
|
|
|
@freezed
|
|
class Ingredient with _$Ingredient {
|
|
const factory Ingredient({
|
|
required String name,
|
|
String? unit,
|
|
required String portion,
|
|
}) = _Ingredient;
|
|
|
|
factory Ingredient.fromJson(Map<String, Object?> json) => _$IngredientFromJson(json);
|
|
}
|
|
|
|
@freezed
|
|
class Step with _$Step {
|
|
const factory Step({
|
|
required String image,
|
|
required String description,
|
|
}) = _Step;
|
|
|
|
factory Step.fromJson(Map<String, Object?> json) => _$StepFromJson(json);
|
|
}
|