feat(recipe): edit recipe

This commit is contained in:
mso7nueh
2025-05-19 15:40:00 +03:00
parent 2a1c1dc56d
commit b2b2253f06
18 changed files with 328 additions and 147 deletions

View File

@@ -55,6 +55,27 @@ enum TypeOfRecipe {
}
}
static TypeOfRecipe? fromApiType(String value) {
switch (value) {
case 'first_meals':
return TypeOfRecipe.firstMeals;
case 'second_meals':
return TypeOfRecipe.secondMeals;
case 'salads':
return TypeOfRecipe.salads;
case 'snacks':
return TypeOfRecipe.snacks;
case 'sweets':
return TypeOfRecipe.sweets;
case 'drinks':
return TypeOfRecipe.drinks;
case 'other':
return TypeOfRecipe.other;
default:
return null;
}
}
static TypeOfRecipe? fromString(String value) {
switch (value) {
case 'Первые блюда':
@@ -80,6 +101,7 @@ enum TypeOfRecipe {
@freezed
class RecipeCreateEntity with _$RecipeCreateEntity {
const RecipeCreateEntity._();
const factory RecipeCreateEntity({
String? title,
TypeOfRecipe? typeOfRecipe,
@@ -94,7 +116,7 @@ class RecipeCreateEntity with _$RecipeCreateEntity {
String? videoUrl,
required List<Ingredient> ingredients,
required List<StepEntity> steps,
required List<String> tags, // tags for search
required List<String> tags,
}) = _RecipeCreateEntity;
RecipeModel toModel() => RecipeModel(
@@ -118,6 +140,7 @@ class RecipeCreateEntity with _$RecipeCreateEntity {
@freezed
class StepEntity with _$StepEntity {
const StepEntity._();
const factory StepEntity({
String? description,
File? image,