forked from eatvio/eatvio_app
feat: Introduce user-generated content features, including recipe creation and management, and blog post creation.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:eatvio_app/features/create_recipe/models/recipe_model.dart';
|
||||
import 'package:eatvio_app/features/create_recipe/models/step.dart' as cr_step;
|
||||
import 'package:eatvio_app/features/create_recipe/models/ingredient.dart' as cr_ingredient;
|
||||
import 'package:eatvio_app/features/feed/models/recipes_model.dart';
|
||||
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
@@ -83,3 +84,26 @@ extension MyRecipeModelX on MyRecipeModel {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
extension RecipeToRecipeModelX on Recipe {
|
||||
RecipeModel toRecipeModel() {
|
||||
return RecipeModel(
|
||||
title: title,
|
||||
description: description,
|
||||
image: image,
|
||||
totalCookingTime: cookingTime,
|
||||
activeCookTime: activeCookingTime,
|
||||
energyPerServing: calories.toInt(),
|
||||
videoUrl: videoUrl,
|
||||
state: 'active',
|
||||
steps: steps?.map((e) => cr_step.Step(image: e.image, description: e.description)).toList(),
|
||||
ingredients: ingredients?.map((e) => cr_ingredient.Ingredient(
|
||||
name: e.name,
|
||||
portion: e.portion,
|
||||
unit: e.unit ?? '',
|
||||
productId: e.productId,
|
||||
)).toList() ?? [],
|
||||
tags: tags.map((e) => e.name).toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user