forked from eatvio/eatvio_app
feat(recipe): edit recipe
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user