feat: Introduce user-generated content features, including recipe creation and management, and blog post creation.

This commit is contained in:
mso7nueh
2026-02-26 02:52:08 +03:00
parent 0641513ebe
commit 0b2e026d1d
5 changed files with 127 additions and 68 deletions

View File

@@ -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(),
);
}
}