From ae70064c068b75eaa6eb7efd9fc46194b71f4371 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 24 Feb 2024 13:05:23 +0100 Subject: [PATCH] renamed ingredients_markdown and removed ingredients_vue --- .gitignore | 2 ++ cookbook/serializer.py | 31 +++++++++++++--------------- vue/src/components/StepComponent.vue | 2 +- vue/src/utils/openapi/api.ts | 4 ++-- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 553403a5..1657d4ca 100644 --- a/.gitignore +++ b/.gitignore @@ -87,3 +87,5 @@ vue/webpack-stats.json cookbook/templates/sw.js .prettierignore vue/.yarn +vue3/.vite +vue3/node_modules diff --git a/cookbook/serializer.py b/cookbook/serializer.py index 8446e3fb..e72c776d 100644 --- a/cookbook/serializer.py +++ b/cookbook/serializer.py @@ -337,7 +337,7 @@ class UserSpaceSerializer(WritableNestedModelSerializer): class Meta: model = UserSpace fields = ( - 'id', 'user', 'space', 'groups', 'active', 'internal_note', 'invite_link', 'created_at', 'updated_at',) + 'id', 'user', 'space', 'groups', 'active', 'internal_note', 'invite_link', 'created_at', 'updated_at',) read_only_fields = ('id', 'invite_link', 'created_at', 'updated_at', 'space') @@ -772,8 +772,7 @@ class IngredientSerializer(IngredientSimpleSerializer): class StepSerializer(WritableNestedModelSerializer, ExtendedRecipeMixin): ingredients = IngredientSerializer(many=True) - ingredients_markdown = serializers.SerializerMethodField('get_ingredients_markdown') - ingredients_vue = serializers.SerializerMethodField('get_ingredients_vue') + instructions_markdown = serializers.SerializerMethodField('get_instructions_markdown') file = UserFileViewSerializer(allow_null=True, required=False) step_recipe_data = serializers.SerializerMethodField('get_step_recipe_data') recipe_filter = 'steps' @@ -782,10 +781,7 @@ class StepSerializer(WritableNestedModelSerializer, ExtendedRecipeMixin): validated_data['space'] = self.context['request'].space return super().create(validated_data) - def get_ingredients_vue(self, obj): - return obj.get_instruction_render() - - def get_ingredients_markdown(self, obj): + def get_instructions_markdown(self, obj): return obj.get_instruction_render() def get_step_recipes(self, obj): @@ -800,8 +796,8 @@ class StepSerializer(WritableNestedModelSerializer, ExtendedRecipeMixin): class Meta: model = Step fields = ( - 'id', 'name', 'instruction', 'ingredients', 'ingredients_markdown', - 'ingredients_vue', 'time', 'order', 'show_as_header', 'file', 'step_recipe', + 'id', 'name', 'instruction', 'ingredients', 'instructions_markdown', + 'time', 'order', 'show_as_header', 'file', 'step_recipe', 'step_recipe_data', 'numrecipe', 'show_ingredients_table' ) @@ -846,7 +842,7 @@ class UnitConversionSerializer(WritableNestedModelSerializer, OpenDataModelMixin class Meta: model = UnitConversion fields = ( - 'id', 'name', 'base_amount', 'base_unit', 'converted_amount', 'converted_unit', 'food', 'open_data_slug') + 'id', 'name', 'base_amount', 'base_unit', 'converted_amount', 'converted_unit', 'food', 'open_data_slug') class NutritionInformationSerializer(serializers.ModelSerializer): @@ -873,6 +869,13 @@ class RecipeBaseSerializer(WritableNestedModelSerializer): return False +class CommentSerializer(serializers.ModelSerializer): + class Meta: + model = Comment + fields = '__all__' + read_only_fields = ['id', 'created_at', 'created_by', 'updated_at',] + + class RecipeOverviewSerializer(RecipeBaseSerializer): keywords = KeywordLabelSerializer(many=True) new = serializers.SerializerMethodField('is_recipe_new') @@ -950,12 +953,6 @@ class RecipeImportSerializer(SpacedModelSerializer): fields = '__all__' -class CommentSerializer(serializers.ModelSerializer): - class Meta: - model = Comment - fields = '__all__' - - class CustomFilterSerializer(SpacedModelSerializer, WritableNestedModelSerializer): shared = UserSerializer(many=True, required=False) @@ -1150,7 +1147,7 @@ class ShoppingListEntrySerializer(WritableNestedModelSerializer): 'recipe_mealplan', 'created_by', 'created_at', 'updated_at', 'completed_at', 'delay_until' ) - read_only_fields = ('id', 'created_by', 'created_at','updated_at',) + read_only_fields = ('id', 'created_by', 'created_at', 'updated_at',) class ShoppingListEntryBulkSerializer(serializers.Serializer): diff --git a/vue/src/components/StepComponent.vue b/vue/src/components/StepComponent.vue index 9585a3a7..3d25335e 100644 --- a/vue/src/components/StepComponent.vue +++ b/vue/src/components/StepComponent.vue @@ -44,7 +44,7 @@
-
diff --git a/vue/src/utils/openapi/api.ts b/vue/src/utils/openapi/api.ts index 45749f4d..5e642c7a 100644 --- a/vue/src/utils/openapi/api.ts +++ b/vue/src/utils/openapi/api.ts @@ -2878,7 +2878,7 @@ export interface RecipeSteps { * @type {string} * @memberof RecipeSteps */ - ingredients_markdown?: string; + instructions_markdown?: string; /** * * @type {string} @@ -3731,7 +3731,7 @@ export interface Step { * @type {string} * @memberof Step */ - ingredients_markdown?: string; + instructions_markdown?: string; /** * * @type {string}